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

minmax 8 and 16 bit elements are not vectorized #4660

Closed
AlexGuteniev opened this issue May 7, 2024 · 1 comment · Fixed by #4913
Closed

minmax 8 and 16 bit elements are not vectorized #4660

AlexGuteniev opened this issue May 7, 2024 · 1 comment · Fixed by #4913
Labels
fixed Something works now, yay! performance Must go faster ranges C++20/23 ranges

Comments

@AlexGuteniev
Copy link
Contributor

Oversight in initial implementation in #4384. Noticed while benchmarking #4659

Might be superseded by #4453.

The optimization is performed in _Minmax_fwd_unchecked. We don't pick this branch for smaller elements, because _Prefer_iterator_copies evaluates to false.

STL/stl/inc/algorithm

Lines 10417 to 10420 in 8dc4faa

if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<iterator_t<_Rng>>) {
return _Minmax_fwd_unchecked(
_STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj));
} else {

@StephanTLavavej StephanTLavavej added performance Must go faster ranges C++20/23 ranges labels May 8, 2024
@StephanTLavavej
Copy link
Member

Great catch! We should be careful to avoid regressing perf for non-vectorized scenarios here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! performance Must go faster ranges C++20/23 ranges
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants