On 2/23/2014 1:53 PM, Walter Bright wrote:
And yes, performance critical code often suffers from bit rot, and changes in
the compiler, and needs to be re-tuned now and then.

BTW, just to reiterate, there are *thousands* of optimizations the compiler may or may not do. And yes, performance critical code will often rely on them, and code is often tuned to 'tickle' certain ones.


For example, I know a fellow years ago who thought he had invented a spectacular new string processing algorithm. He had the benchmarks to prove it, and published an article with his with/without benchmark.

Unfortunately, the without benchmark contained an extra DIV instruction that, due to the vagaries of optimization, the compiler hadn't elided. That DIV had nothing to do with the algorithm, but the benchmark timing differences were totally due to its presence/absence.

He would have spotted it if he'd ever looked at the asm generated, and saved himself from some embarrassment.


I understand that in an ideal world one should never have to look at asm, but if you're writing high performance code and don't look at asm, the code is never going to beat the competition.

Reply via email to