3 ms·
Update: The Rust versions can all be made to run faster with a simple edit. I've updated the timings and edited some of the text.
by atilaneves 8y ago
Update: The Rust versions can all be made to run faster with a simple edit. I've updated the timings and edited some of the text.
- dralley 8y agoThis was a really good and worthwhile analysis, thanks! Despite the changes people are submitting, it's good to know about these different gotchas. And there may be one or two actual compiler enhancements that could be made here also.
- vlovich123 8y agoNot mentioned in the post but I'm assuming you're using O0 for "debug"? It may be worthwhile to reconsider as O0 is now considered to be a tool for compiler authors & regular people should use -Og (or opt-level 1 for Rust) as a way of generating builds that have performance optimizations applied that don't impact debugging.
- ZirconiumX 8y agoI've usually found -Og to inline functions or optimise out variables I needed to investigate. It's happened often enough that I just use printf in release mode.