vector_algorithms.cpp
: further cleanup
#5485
Merged
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.
search_n
Generalize the first step for every element size, making the whole approach more readable and use fewer lines of code.
mismatch
Reduce element size variation. We can always compare bytewise, the division by element size would truncate the unneeded remainder length.
The 8 byte element instruction is a bit of odd ball 🎱. The SSE version has a bit higher CPU requirement (SSE4.2, not SSE2), it is a bit longer, and a bit less efficient. Still I don't think it is a performance change: I think the compiler would emit memory-operand version on AVX2 path, which does not differ in performance from the 1-byte equivalent.
minmax_element
Just more tails closer to the function where they are used. Traits are used in all functions here, tails are only for
minmax_element
bitset from string
Move AVX2 exit intrinsic inside the implementation function to make the compiler emit a tail call. A perf change, though a very small one.
bitset to string
Ditto. But this time it didn't help emitting tail call. Still done for consistency.