r/cpp • u/pavel_v • Oct 21 '25
When Compiler Optimizations Hurt Performance
https://nemanjatrifunovic.substack.com/p/when-compiler-optimizations-hurt
66
Upvotes
r/cpp • u/pavel_v • Oct 21 '25
View all comments
Show parent comment
7
u/SLiV9 Oct 22 '25
The author mentioned the benchmark is done on datasets that are pure ASCII which makes all measurements kind of silly because of course a branch predicted ascii branch is going to be faster than a generic branchless function.
But yes you're right, if your data contains non-ascii but is mostly English text, there will be plenty of optimizations possible if you allow branching. You could use simd and compare 8+ bytes for ascii-ness at the same time, for example, and then jump forward by 8+ bytes.