Skip to content

Conversation

@ZhangYu0123
Copy link
Contributor

@ZhangYu0123 ZhangYu0123 commented Apr 9, 2023

Proposed changes

Use SIMD stringsearcher and SIMD memcmp optimze split_by_string and substring_index function.

  • split_by_string function has 32%~540% up
  • substring_index function has 22%~46% up

Performance difference depends on the needle size and whether the needle is constant param. And the longer the needle, the more performance improvement

(1) split_by_string 32%~540% up

needle before after up comment
needle size 6, constant 6.6s image 1.14s image 540% use StringSearcher
needle size 6, vector 6.62s image 2.94s image 120% use SIMD memcmp
needle size 1, constant 4.08s image 1.32s image 200% use StringSearcher
needle size 1, vector 4.14s image 3.14s image 32% use SIMD memcmp

(2) substring_index 22%~46% up

  1. needle vector params are not supported.
  2. when needle size 1, memchr is 6% faster than SIMD stringsearcher.
  3. when needle size greater than 1, stringsearcher is better than memmem.
needle before after up comment
needle size 6, constant 1.48s image 1.03s image 46% use StringSearcher
needle size 2, constant 1.27s image 1.03s image 22% use StringSearcher

Issue Number: close #xxx

Problem summary

Describe your changes.

Checklist(Required)

  • Does it affect the original behavior
  • Has unit tests been added
  • Has document been added or modified
  • Does it need to update dependencies
  • Is this PR support rollback (If NO, please explain WHY)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions bot added area/sql/function Issues or PRs related to the SQL functions area/vectorization labels Apr 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2023

clang-tidy review says "All clean, LGTM! 👍"

@ZhangYu0123 ZhangYu0123 force-pushed the optimize_splitbystring branch from 6861e4a to 6015919 Compare April 9, 2023 13:11
@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2023

clang-tidy review says "All clean, LGTM! 👍"

@ZhangYu0123
Copy link
Contributor Author

run buildall

@ZhangYu0123 ZhangYu0123 marked this pull request as ready for review April 9, 2023 23:04
@ZhangYu0123
Copy link
Contributor Author

run arm

@ZhangYu0123
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 10, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit 0c5e3df into apache:master Apr 11, 2023
gnehil pushed a commit to gnehil/doris that referenced this pull request Apr 21, 2023
…ion (apache#18496)

Use SIMD stringsearcher and SIMD memcmp optimze split_by_string and substring_index function.

split_by_string function has 32%~540% up
substring_index function has 22%~46% up
Performance difference depends on the needle size and whether the needle is constant param. And the longer the needle, the more performance improvement
Reminiscent pushed a commit to Reminiscent/doris that referenced this pull request May 15, 2023
…ion (apache#18496)

Use SIMD stringsearcher and SIMD memcmp optimze split_by_string and substring_index function.

split_by_string function has 32%~540% up
substring_index function has 22%~46% up
Performance difference depends on the needle size and whether the needle is constant param. And the longer the needle, the more performance improvement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/sql/function Issues or PRs related to the SQL functions area/vectorization reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants