1
0
mirror of https://github.com/microsoft/GSL.git synced 2025-05-04 05:41:19 -04:00
Carson Radtke f8ec309118
improve performance of span_iterator w/ clang ()
* improve performance of span_iterator w/ clang

Issue: 

Before this PR, the range-for loop was ~3300x slower. After this PR, it
is ~1.005x slower

The clang optimizer is very good at optimizing `current != end`, so
we changed to this idiom. This moves the Expects assertion into the
constructor instead of on the hot-path which is called whenever either
operator++ or operator* is called.

Note: The codegen for the assertion is still a missed optimization,
but less worrisome as it only happens once per iterator.

Note: benchmarks on M1 Macbook Pro w/ Apple Clang 16.0.0
2024-11-12 15:41:21 -06:00
..
gsl
2024-10-15 17:26:45 -05:00
2024-10-11 19:46:21 -05:00