Sunday, July 25, 2010

The Great Haskell Compiler shootout

David has been working very hard recently on improving LHC and the nobench benchmark suite, in order to actively benchmark LHC against several other haskell compilers: GHC, JHC and UHC.

I figured I'd pop in and announce the benchmarks now that the latest HEAD version of LHC can compile many of them and we can get some meaningful numbers. You can see the results here. Note there are two columns for JHC: one using john's new garbage collector (via `-fjgc`) and one without, because naturally it tends to affect performance characteristics quite a bit. Some of the numbers are quite interesting: in particular, JHC is nearly 400x faster(!) than GHC on the atom benchmark, and UHC dominates the calendar benchmark currently (we haven't investigated why GHC isn't winning here.) There are also some interesting variations in JHC, where the garbage collector wins in some cases, loses in others, but makes the difference in some between actually running and running out of memory (as you would expect.)

Perhaps somewhat regrettably, LHC loses in every benchmark. But we're only just beginning to implement real optimizations now that things are somewhat stabilized and the interface isn't arcane - prior to this we had very few optimizations outside of dead code elimination, simplification and a bit of inlining. David's begun implementing some more exotic optimizations recently, so it'll be interesting to see the results soon.

Now we'll be able to more actively see the progress of optimizing haskell compilers. Should be fun!


  1. Is there some place we can grab this new and improved nobench suite from? Any improvements to benchmark suites for Haskell would be great!

  2. When I implemented SAT for GHC atom sped up by a factor of about 100
    because the key bottleneck is a function like this:

    f x y z = e : f x y z

    Once this is SATed it stops allocating O(n in length of list demanded)
    to O(1). This is a rather large saving!

  3. David:
    darcs get