4 ms·
> all you can really do is code C, compile with -O2, and then guess and check on optimizations This is just not true for performance-critical code. I've seen h
by onan_barbarian 15y ago
> all you can really do is code C, compile with -O2, and then guess and check on optimizations
This is just not true for performance-critical code. I've seen huge swings in performance from hand-arranging code to achieve better instruction-level parallelism, less loop overhead, etc. Not an order of magnitude but 3-5x routinely.
This is not worth doing for random bits of code outside serious hot spots, mind you, and it's become quite difficult to guess how a modern processor (e.g. Core 2 x86 or beyond) is going to execute instructions. Profiling with event counters as well as using IACA (Intel's static analyzer) becomes necessary, as does close reading of their optimization reference manual.