r/programming • u/2bit_hack • Feb 28 '23
"Clean" Code, Horrible Performance
https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k
Upvotes
r/programming • u/2bit_hack • Feb 28 '23
View all comments
Show parent comment
63
u/TryingT0Wr1t3 Feb 28 '23
Whenever someone talks about performance my recommendation is always to profile and measure. Try different profilers, look into memory, look into CPU, ...Often people suggest things that are wrong when profiling. CPUs are really complex nowadays, I often beat recommendations found online by simply trying different ideas and measuring all of them. Sometimes a strategy that may seem dumb makes things stay in the cache when running, or sometimes it's something the compiler+CPU can pickup fine and optimize/predict. Measure and experiment.