[Haskell-cafe] Re: ANN: HLint 1.2

Simon Marlow marlowsd at gmail.com
Tue Jan 13 07:24:17 EST 2009

Max Bolingbroke wrote:
> 2009/1/12 Jan-Willem Maessen <jmaessen at alum.mit.edu>:
>> On Jan 12, 2009, at 9:01 AM, Duncan Coutts wrote:
>>> No because the current definition are recursive and ghc cannot inline
>>> recursive functions.
>>> ....
>>> Then the map can be inlined at the call site and the 'f' inlined into
>>> the body of 'go'.
>> This seems like exactly the sort of mechanical transformation that computers
>> do quickly and accurately, and humans get wrong.  Surely it wouldn't be that
>> hard for GHC to transform self recursion in this way (possibly subject to
>> the condition that the result be worth inlining)?
> GHC should indeed be doing so. I'm working (on and off) to work out
> some suitable heuristics and put the transformation into ghc -O2.
> There are a few wrinkles that still need sorting out, but preliminary
> indications are that it decreases the runtime of our standard
> benchmark suite, nofib, by 12% or so.


That's a surprising result - have you looked closely at the places where 
the transformation is having a big effect to see what's going on?


More information about the Haskell-Cafe mailing list