Skip to content

vectorize find_first_of for long needle 🪡 - #4557

Merged
Stephan T. Lavavej (StephanTLavavej) merged 4 commits into
microsoft:mainfrom
AlexGuteniev:long_needle
Apr 9, 2024
Merged

Stephan T. Lavavej (StephanTLavavej) merged 4 commits into
microsoft:mainfrom
AlexGuteniev:long_needle

Conversation

@AlexGuteniev

@AlexGuteniev Alex Guteniev (AlexGuteniev) commented Apr 2, 2024 •

Copy link
Copy Markdown
Contributor

In benchmark results only the last line changed:

before

-----------------------------------------------------------------
Benchmark                       Time             CPU   Iterations
-----------------------------------------------------------------
bm            2.70 ns         2.35 ns    597333333
bm           2.71 ns         2.13 ns    689230769
bm            14.1 ns         10.9 ns    112000000
bm           12.4 ns         10.6 ns    100000000
bm            9.77 ns         7.70 ns    190638298
bm           10.4 ns         8.06 ns    162909091
bm           10.1 ns         8.02 ns    208372093
bm          11.0 ns         8.64 ns    151864407
bm          273 ns          233 ns      5973333
bm         561 ns          425 ns      3089655
bm        95.5 ns         79.2 ns     17568627
bm       2872 ns         2448 ns       497778

after

-----------------------------------------------------------------
Benchmark                       Time             CPU   Iterations
-----------------------------------------------------------------
bm            2.71 ns         1.80 ns    746666667
bm           2.71 ns         1.55 ns   1000000000
bm            14.1 ns         7.47 ns    175686275
bm           12.3 ns         5.82 ns    190638298
bm            9.78 ns         6.75 ns    208372093
bm           10.7 ns         7.54 ns    190638298
bm           10.3 ns         7.21 ns    169056604
bm          11.1 ns         8.63 ns    175686275
bm          276 ns          205 ns     11200000
bm         552 ns          432 ns      2890323
bm        94.4 ns         76.2 ns     19478261
bm        481 ns          365 ns      3895652

@AlexGuteniev
Alex Guteniev (AlexGuteniev) requested a review from a team as a code owner April 2, 2024 19:22
@StephanTLavavej

This comment was marked as resolved.

@AlexGuteniev

Copy link
Copy Markdown
Contributor Author

There are real test failures here.

There were multiple errors.

After fixing all of them, I thought it would be better to preserve the <= 16 version, as the generic becomes noticeable slower.

@AlexGuteniev

Copy link
Copy Markdown
Contributor Author

Review with "hide whitespace difference" to see the <= 16 branch preserved.

@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 5ced5d2 into microsoft:main Apr 9, 2024
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for improving your vectorized implementation even further! 🚀 🚀 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants