Throwing Tools at Ranges
summary
Compares three implementations — C-style C++, C++17, C++23/ranges — using Google Benchmark, cach Grint and the Visual Studio profiler on Windows and Linux. Finds ranges version initially has many more instruction refs and is much slower because the cartesian_product view evaluates twice; forcing materialization to a vector removes duplicated work and roughly doubles performance. C-style uses the fewest instructions; after targeted changes all versions run similarly fast and memory/cache behavior explains remaining differences.
AI-written summary · about
chapters (12)
- 0:00Talk introduction and setup
- 2:18Analysis tools and environment
- 4:25Overview of code examples
- 6:32Analyzing the first function
- 10:39Analyzing the second function
- 12:50Analyzing the third function
- 17:05Initial benchmarking results
- 19:45Cache grind profiling analysis
- 29:50Visual Studio profiling demo
- 43:25Optimizing the code examples
- 49:27Final results and comparison
- 51:43Conclusion and Q&A
related talks
01h 04mEffective Ranges: A Tutorial for Using C++2x Ranges
01h 00mBack to Basics: (Range) Algorithms in C++
01h 00mMissing (and future?) C++ range concepts
01h 06mConquering C++20 Ranges
55mC++ Cache Friendly Data + Functional + Ranges = ❤️
01h 00mC++ Mythbusters
01h 04mRange adaptors - 5 years after C++20
40mRanges and Iterators for Numerical Problems
