Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve performance of span_iterator w/ clang (microsoft#1166)
* improve performance of span_iterator w/ clang Issue: microsoft#1165 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
- Loading branch information