[Haskell-cafe] weird behavior using HUnit

Keith Wansbrough Keith.Wansbrough at cl.cam.ac.uk
Mon Jan 24 07:19:59 EST 2005


> > GHC's memory profiling?
> 
> I just gave it a try: when compiled with -prof -auto-all, my program
> is memory hungry in both cases, so I cannot really compare...

[cc'd back to list in case anyone else finds this useful; hope that's OK]

Ah.  The cost-centre annotations get in the way of the optimiser,
preventing certain optimisations from being performed.

It's possible that the new entry point you introduce with testParseLog
is similarly preventing something from being inlined.

The way to tell (sadly!) is to look at the intermediate code being
generated by GHC.  In fact there are several intermediate codes to
look at.  Most of the optimisation work is done while the program is
in a form called "Core"; if you look at the result of the optimiser
(sometimes called the "simplifier", confusingly) just before this Core
is translated to STG you will get the most readable and useful
information.

http://www.haskell.org/ghc/docs/latest/html/users_guide/options-debugging.html#DUMPING-OUTPUT

tells you how, and also explains how to read the output.  -ddump-simpl
is probably what you want, but it's a while since I've had a look - I
could be wrong.  Compare what you get with and without that HUnit line
that's causing trouble, and see how the critical function is affected.

HTH.

--KW 8-)



More information about the Haskell-Cafe mailing list