r/cpp • • 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!

131 Upvotes

185 comments sorted by

View all comments

Show parent comment

4

u/TitianPlatinum Feb 17 '26

I feel like I saw a CPP con talk or something where they showed how to easily generate tables like that at compiletime, it was pretty cool

2

u/_Noreturn Feb 17 '26

you can use constexpr but tbh I would recommend having a python script that generates a header file instead this saves compilation time