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
6
u/max123246 Feb 16 '26
Eh, choosing cache friendly data structures is something no compiler can optimize for since that's part of the program's semantics.
I agree that on the whole when building a project, it's usually a good tradeoff to make code more readable at the sacrifice of some performance, especially if you don't have certain targets you need to hit.
But it's still a tradeoff and we should be aware of that. By assuming that we can never think about optimizing our code is how we end up with our current desktop situation where each application runs its own full web browser.