20 points · by jessaustin · 11y ago · 4 comments
Instead, I'd suggest that if you want to write really high performance code, you need to be thinking in assembly regardless of the language you are writing the actual code in. Look at the code that's actually executing, either by disassembling the compiled object or profiling with something like 'perf' on Linux.[1] Then, you need to be aware of how the processor handles that assembly, in terms of latencies and execution ports. Agner Fog's manuals in combination with those from Intel and AMD are incredibly valuable.
Aggressive unrolling consumes more instruction cache space and hurts performance elsewhere.