Is the probability really so high as to be 100% that all optimization tests were against a poorly written competitor? That's amazing if that's the case.
Is the probability really so high as to be 100% that all optimization tests were against a poorly written competitor? That's amazing if that's the case.
So, while some researchers have gotten it such that a relatively straight forward implementation in a new language with new tools is better than the old way, the folks working the old way have not exactly stagnated.
This seems especially likely when you consider that for many of the really fast implementations, it is not that they are using no abstractions. The abstractions they are using are very close to the machine, because the machine is the abstraction they are using. (That make sense?)
double s = 0;
for(int i=0; i<n; i++) s += pow(a[i]-b[i],2);
return s;
But they did not use this C code. The C code they used made 3 calls to the BLAS library. The end result is that the C code is doing something equivalent to this: double x=0, y=0, z=0;
for(int i=0; i<n; i++) x += a[i]*a[i];
for(int i=0; i<n; i++) y += a[i]*b[i];
for(int i=0; i<n; i++) z += b[i]*b[i];
return x - 2*y + z;
While this does return the same result (assuming infinite precision arithmetic) it is obviously not the way anybody would do it, since it's doing 3 times the work. Even worse, because their code is calling into the BLAS library for each loop, the compiler is explicitly prevented from optimizing the three loops and memory accesses by combining them into one. Note that the Haskell code is doing the efficient single loop. So yes, it is poorly written code.The 1x BLAS that uses 2x RAM gets shafted, presumably by cache lossage.
That said, a lot of benchmarks are just completely bogus. It's surprisingly common to see someone claim that they're beating the "state of the art" when they're comparing against a weak baseline. One problem is that people don't understand the systems they're benchmarking sufficiently well to obtain good results.
In this case, I have no doubt the results are much better than they've obtained in Haskell before - I think they've done an impressive job and I don't doubt the value of the work. But if the question is whether rewriting your C code in Haskell would make it go faster... well... I wouldn't bet the house on it.