r/cpp • u/pavel_v • Oct 21 '25
When Compiler Optimizations Hurt Performance
https://nemanjatrifunovic.substack.com/p/when-compiler-optimizations-hurt
69
Upvotes
r/cpp • u/pavel_v • Oct 21 '25
View all comments
Show parent comment
7
u/ReDucTor Game Developer | quiz.cpp-perf.com Oct 21 '25 edited Oct 21 '25
Likely
lead_byteis going to be read from memory in the caller and be a data dependency for the return value, likely better then the chaining of data dependencies for the lookup table but I suspect that the branch based version would be better for a mostly ASCII text.EDIT: I threw together a small quick-bench version to show the differences and see if it changed much, as expected only a minor improvement compared to the branch version
https://quick-bench.com/q/NDAK5Vx4UpMK7WrGNBOBBVo1Fzs