tcbrindle / flux

A C++20 library for sequence-orientated programming
https://tristanbrindle.com/flux/
Boost Software License 1.0
441 stars 28 forks source link

Specialise for_each_while for multipass + bounded sequences #181

Closed tcbrindle closed 4 months ago

tcbrindle commented 4 months ago

From #173, it seems like the existing formulation of for_each_while() using an is_last() end check appears to get in the way of compiler auto-vectorisation in some circumstances.

For bounded + multipass sequences, we can instead save the end cursor as a local variable and perform an end check against that. This appears to make Clang more eager to vectorise the code in the loop, so let's do it.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.07%. Comparing base (bf3540b) to head (6679696).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #181 +/- ## ======================================= Coverage 98.06% 98.07% ======================================= Files 69 69 Lines 2433 2440 +7 ======================================= + Hits 2386 2393 +7 Misses 47 47 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.