equivalent of EXPLAIN PLAN with GHC?

Don Stewart dons at galois.com
Sun Aug 2 04:10:30 EDT 2009

> Hello Joshua,
> Sunday, August 2, 2009, 11:45:57 AM, you wrote:
> >>           94,604 bytes allocated in the heap
> > Is there any way I could find out what these 94kb of RAM were
> > allocated  for?  This seems high -- my entire program's working set
> > is <6kb.
> as Don said, compiled code works on Int# (which is the same as C int)
> but probably not via registers. instead, each intermediate value
> allocated in heap, so there are total 90 bytes per iteration = about
> 22 integers

In my example, there's no heap allocation. In the version with
build/foldr though, there will be heap nodes passed to sum.

The fused one results in,

          32,160 bytes allocated in the heap

But there's no heap allocation in the filtering code, only once we have
to construct the string to print.

-- Don

More information about the Glasgow-haskell-users mailing list