4 ms·
I avoid these types of optimizations, say, 97% of the time This reminded me of Linus' blog post on optimizing SHA1 routines in Git [0]. FTA: "Some people seem
by jakevoytko 16y ago
I avoid these types of optimizations, say, 97% of the time
This reminded me of Linus' blog post on optimizing SHA1 routines in Git [0]. FTA: "Some people seem to think that C is a real programming language, but they are sadly mistaken. It really is about writing almost-portable assembly language, and it turns out that getting good results from SHA1 really is mostly about trying to fight the compilers tendency to try to be clever."
[0] http://torvalds-family.blogspot.com/2009/08/programming.html http://torvalds-family.blogspot.com/2009/08/programming.html
- stcredzero 16y agoA long, long time ago, I recall that someone did a study of code generated by C compilers and found that, on average, 1 C statement = 2.5 lines of assembly. (for CISC)
- briansmith 16y ago"Improving the Performance of the Secure Hash Algorithm" (by transforming the algorithm mathematically and then using hand-written assembler with SIMD instructions): http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1/ http://software.intel.com/en-us/articles/improving-the-perfo...
- igorgue 16y agoSHA1 is still pretty damn fast in Git, I couldn't be able to get an even close speed with my own implementation.
- grogers 16y agoThere is a self tuning linear algebra library called ATLAS. When building, probes various things about your computer, things like L1/L2 cache, if you have fused multiply/add, etc. It uses these to output very highly tuned matrix kernels in standard C. Ironically, when compiling this C code, you have to use -O, higher optimization levels make the compiler try to be too smart for its own good and actually perform worse.