r/cpp • u/Little-Reflection986 • Feb 16 '26
Favorite optimizations ??
I'd love to hear stories about people's best feats of optimization, or something small you are able to use often!
135
Upvotes
View all comments
Show parent comment
1
u/scrumplesplunge Feb 18 '26
Agreed, they are fragile in general. Typically when I'm using something like this it is because I want code that will fall back to "working but slower" if I use it on some strange system, rather than just breaking.
That armv8 case is interesting, I had assumed that llvm would detect the pattern in a platform agnostic way and different backends would apply the pattern but the IR is completely different for armv8 and x86-64 with neither of them simply being a primitive op for loading or byteswapping.