GHC code generation micro-optimisation patch

Simon Marlow simonmarhaskell at
Mon Mar 3 07:30:12 EST 2008

Remi Turk wrote:

> during the past semester I followed a seminar on the "Efficient
> implementation of functional languages" by Jeroen Fokker at the
> University Utrecht. During that course we worked on a feedback
> directed GHC optimisation, but that got me interested in another
> possible GHC backend micro-optimisation:
> The short story is this:
> An 8 line patch to GHC, tested with ghc 6.8.2 on nofib, ignoring all
> results with a < 0.5s runtime, yields an average runtime and
> compile time improvement of about 0.6%.
> The worst nofib slowdown is 5%, and the best speedup 8%
> Whether this is acceptable/enough for inclusion, is of course not
> up to me.

Hi Remi - thanks very much for the patch.  It certainly looks worthwhile. 
I have some pending changes myself to mk_switch - it turns out that we're 
doing quite a bad job of compiling 3-way comparisons too (look at the code 
for fib sometime), so I'll try to incorporate your change into my refactorings.


More information about the Glasgow-haskell-users mailing list