4 ms·
CPU makers add so many complicated features to let users optimize their programs that it takes too much knowledge for mere mortals to optimize their programs -
by astrobe_ 5y ago
CPU makers add so many complicated features to let users optimize their programs that it takes too much knowledge for mere mortals to optimize their programs - That you have to rely on heuristics and measures, as it is usually and wisely advised, is a bit unsatisfying. That's sort of ironic, in a way.
I used to do assembly and count cycles, but now I wouldn't dare; it's hardcore compiler and library makers stuff. It's like "don't do your own crypto (optimization)".
Everyone knows why it is so, though - we cannot solve the problem by throwing more Gigahertz at it.
- cout 5y agoI have hand-written asm for use in production code, and I would do it again. I also knew exactly what cpu my code would be running on. If I were publishing the code to run on a variety of hardware, I would be very cautious. Writing your own crypto is very different; the stakes are higher if you get it wrong.
- pjmlp 5y agoIncluding the microcode version currently installed into the CPU and gone through the release notes, alongside a profile like V-Tune?
- WalterBright 5y agoA good heuristic is simply minimize the number of instructions.
- kierank 5y agoThis is definitely not correct. For many SIMDable workloads it's possible to achieve order of magnitude improvements over the compiler.