Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement for cudf::string_view::find functions #13100

Merged
merged 19 commits into from
Apr 20, 2023

Conversation

davidwendt
Copy link
Contributor

@davidwendt davidwendt commented Apr 10, 2023

Description

Improves performance of calls to cudf::string_view::find functions for longer strings by minimizing character and byte counting required for resolving the input parameters. The input values are in character positions/counts so range checks do not include bytes that may be in partial characters. Converting these to bytes requires some counting usually from the beginning of the string for any given character position. The code has been reworked to minimizing this counting as much as possible. This improves performance overall by 10% but greatly improves performance for long strings by up to 3x.

Closes #12445

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python) improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 10, 2023
@davidwendt davidwendt self-assigned this Apr 10, 2023
@davidwendt
Copy link
Contributor Author

For cudf::strings::find

rows width baseline (ms) rework (ms) x
4096 32 0.041 0.038 1.1
4096 128 0.075 0.060 1.3
4096 512 0.234 0.169 1.4
4096 2048 0.948 0.465 2.0
4096 8192 4.20 1.40 3.0
32768 32 0.044 0.040 1.1
32768 128 0.081 0.065 1.2
32768 512 0.254 0.197 1.3
32768 2048 1.32 0.523 2.5
32768 8192 4.73 1.48 3.2
262144 32 0.076 0.061 1.2
262144 128 0.215 0.177 1.2
262144 512 3.80 1.40 2.7
262144 2048 21.3 5.70 3.7
2097152 32 0.325 0.215 1.5
2097152 128 1.24 0.944 1.3
2097152 512 30.6 10.0 3.1
16777216 32 2.31 1.44 1.6

For cudf::strings::find_multiple

rows width baseline (ms) rework (ms) x
4096 32 0.048 0.045 1.1
4096 128 0.094 0.073 1.3
4096 512 0.255 0.195 1.3
4096 2048 0.737 0.433 1.7
4096 8192 3.36 1.14 2.9
32768 32 0.053 0.048 1.1
32768 128 0.104 0.083 1.3
32768 512 0.302 0.230 1.3
32768 2048 1.19 0.585 2.0
32768 8192 4.13 1.51 2.7
262144 32 0.123 0.092 1.3
262144 128 0.359 0.239 1.5
262144 512 1.55 0.993 1.6
262144 2048 5.66 2.70 2.1
2097152 32 0.695 0.439 1.6
2097152 128 2.27 1.37 1.7
2097152 512 9.72 6.30 1.5
16777216 32 5.28 3.21 1.6

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Apr 11, 2023
@davidwendt davidwendt marked this pull request as ready for review April 17, 2023 17:24
@davidwendt davidwendt requested a review from a team as a code owner April 17, 2023 17:24
@davidwendt davidwendt requested a review from bdice April 17, 2023 17:24
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Nice optimization!

@davidwendt
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 1df6894 into rapidsai:branch-23.06 Apr 20, 2023
@davidwendt davidwendt deleted the perf-string-view-find branch April 20, 2023 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change strings strings issues (C++ and Python)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Operations with string_view involving character counting are very inefficient
3 participants