3 ms·
There's a key corollary: you also either have to be doing this as a one-off or committed to maintaining it over time as hardware changes and those cool tricks b
by acdha 9y ago
There's a key corollary: you also either have to be doing this as a one-off or committed to maintaining it over time as hardware changes and those cool tricks become moot or even de-optimizations.
- mjw1007 9y agoAlso as your code changes. It's often not that hard to hand-write a single function a bit better than the compiler. But when you want to make a small change the compiler will rethink the whole function from scratch, and if you want to keep your advantage you may have to do the same.
- acdha 9y agoThat's a very important point: this is especially the case when, say, a data structure grows and clever packing or alignment tricks can no longer be used. I certainly remember that being used as an excuse to delay a change because it was much harder to update some complex optimizations — and at least one case where the original developer tested the generic .c file they'd used to develop the algorithm with a current compiler and found it was faster on the latest hardware we were buying.