An LLVM backend for GHC: implementation and benchmarks: PDF
cse.unsw.edu.au
cse.unsw.edu.au
"The native code generator offers the best performance of the three but its a fairly close race, with the LLVM back-end less then 4% percent behind and the C code generator less then 7%. While this is slightly disappointing that LLVM doesn’t provide a performance advantage over the NCG back-end, it is very promising given its early stage of development that it is able to produce code of the same level of quality as the NCG and C back-end. Both of these back-ends benefit from years of work and optimisation, while the new LLVM back-end has only been in development for around 3 months and only just recently reached a usable state."
Data Parallel Haskell:
"[...] the LLVM back-end shows a very impressive performance gain for all the tests, bringing an average reduction of 25% in the runtime of the tests. The reasons for this are two fold. Firstly the LLVM optimiser and register allocator simply outperform the NCG. Secondly and of far greater impact is the use of the custom calling convention used to implement registered mode, as outlined in section 3.3.4."
Also interesting:
"As can be seen from the table, the LLVM optimiser produces no noticeable effect on the runtime of the program, indeed for the nofib benchmark suite it actually slowed it down."
For example, something -99% is 100x as slow as the original, while something +100% is only twice as fast. I think especially the average is wrong. With the above example, the average would be 0%, or 'no change', which IMHO isn't fair.
for(i=0; i<100; i++){ do something }
Then it could just as well have been this: for(i=0; i<10000; i++){ do something }
This change makes that benchmark 100x more important relative to the other benchmarks.IOW, the relative importance of benchmarks in an average is arbitrary. If you measure speedups you give every benchmark the same weight.
The "average" he uses, the geometric mean, doesn't have the problem you describe. The geometric mean of a 99% slowdown and a 100% speedup is computed as sqrt(1/100 * 2) ~= 0.141421356. This means that the "average" slowdown is 1/0.141421356 ~= 7.07x.