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!

139 Upvotes

185 comments sorted by

View all comments

Show parent comment

-5

u/Big_Target_1405 Feb 16 '26 edited Feb 16 '26

Experiment, theorise, measure and iterate.

rdtsc is the finest grain mechanism you have on modern x86 to measure latency (in cycles), then plot histograms of many millions of samples to look at tail latencies.

9

u/thisismyfavoritename Feb 16 '26

you're not really answering the question, which makes it sound like you're actually bullshitting

-2

u/Big_Target_1405 Feb 16 '26

I answered very precisely. It's really not my problem if you can't be arsed to learn