[Haskell-cafe] SCC accounting

Andrew Pimlott andrew at pimlott.net
Wed Feb 1 04:41:21 EST 2006


On Wed, Feb 01, 2006 at 12:28:59AM -0800, Andrew Pimlott wrote:
> The Haskell code looks like
> 
>   predQuery pred = case lookup pred ctxIdx of Just f -> {-# SCC "pq.foo'" #-} f
> 
> Note that f is a function, which we expect to be expensive when it is
> called.  However, that should be charged to the definition of the
> function, right?

We found a work-around:  We replaced f to the right of the annotation
with

    \z z2 z3 -> f z z2 z3

and suddenly the right SCCs showed up in the profile (which enabled us
to find the real leak, which was fixed by one strictness annotation).
Actually, f takes 4 arguments, and forcing only 2 of them was not
sufficient; in fact, forcing only 2 caused a different misleading SCC to
dominate the profile!  I don't claim to understand why.

Andrew


More information about the Haskell-Cafe mailing list