Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Overview
std::search
of 1 and 2 bytes elements withpcmpestri
#4745 in the opposite directionpcmpestri
instruction and variable step, but it looked like multiple-indicespcmpestrm
and fixed step would work better for this direction, because the former would return more partial false matches than in forward direction, as the match with higher index is more likely to be partial.pcmpestrm
approach could have been made more efficient if DevCom-10689455 is fixed, but honestly I don't hope for that much__std_search_impl
, the place where_Match_1st_16
is introduced. I basically implemented the same thing from scratch, and the new attempt gave clearer control flow implementation. They are not shared though, as_First1 > _Stop1
check is needed for variable step, but not needed for fixed step, so here's still some variation.replace
with smaller elements.search
+ closer to start andfind_end
+ closer to end, It is useful to test the case where startup cost contributes more.🏁 Benchmark results
Re-testong of the search PR against then-main as there are more cases in the benchmark