Landing: 15505d012872
Project / Subsystem
gcc / libstdc++
Date
2026-07-31
Author
Patrick Palka
Commit
15505d012872ddb4c20916c41284e913727b4c80
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- 15505d012872ddb4c20916c41284e913727b4c80
- source_type
- github
- headline
- Libstdc++: Optimize ranges::distance for segmented iterators.
- tldr
- ranges::distance is optimized for segmented iterators by summing distances of individual segments.
- author
- Patrick Palka
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • optimization
- • c++20
- • ranges
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-31T00:00:00.000Z
The ranges::distance function in libstdc++ now includes an optimization for segmented iterators. For iterators that span multiple contiguous segments (like those used in std::deque or certain ranges views), ranges::distance is now calculated by summing the distances of each individual segment. This improves performance for operations involving such iterators.