[Haskell-cafe] Announce: ghc-core,
command line pager for reading GHC Core
Don Stewart
dons at galois.com
Fri May 23 12:31:53 EDT 2008
lemming:
>
> On Fri, 23 May 2008, Henning Thielemann wrote:
>
> >An even more advanced tool could show differences between two Core
> >listings. Say I have a program which runs too slow. But if I change a
> >small detail it runs significantly faster - I want to know, how did my
> >change in the Haskell file modified the Core and why the speedup.
> >Showing differences between Core files will certainly be complicated
> >because the generated identifiers are completely different. I don't know
> >whether the order of declarations is a problem.
> >
> >I have an example here where a program becomes faster by a factor of 10
> >with a rather small change. First I thought the slow thing must be the
> >higher order function which occurs in the Core and is not inlined, but it
> >is present in the slow and the fast variant of the program.
>
> In this special example, actually simple 'diff' spotted the critical
> difference, namely a polymorphic function was called. Now I'm in a
> dilemma: I can either INLINE the function, then it's whole body is copied
> into main program, which is not necessary here. However this solution
> would guarantee speed in every case. Or I can SPECIALISE the function,
> then the function will only be called, but with polymorphism overhead
> eliminated. This would only work for a restricted range of types. I'd like
> to have a pragma, that tells GHC to specialise a function for every type
> it is called with.
>
I usually go with inlining, and get GHC as a whole program optimising compiler.
-- Don
More information about the Haskell-Cafe
mailing list