[Haskell-cafe] Inexplicable allocation

Rohan Lean haskell at rohanlean.de
Thu Aug 27 14:04:47 EDT 2009


Hello,

this is my first posting to this List, I hope everything goes well.

Seeing that the haskell is currently poorly represented in the fasta benchmark
at http://shootout.alioth.debian.org/u64q/benchmark.php?test=fasta&lang=all , I
decided to help out the contributors a bit.
My draft already performs considerably better than the current program, but
while optimizing I ran into a weird problem. I already reported this as a ghc
bug, but on IRC I was encouraged to also describe my problem here.

Source of the program:

http://rohanlean.de/pub/ghc_alloc/fasta.hs

Core:

http://rohanlean.de/pub/ghc_alloc/fasta.core

Relevant port of the core (`gen' with inlined `pick'):

http://rohanlean.de/pub/ghc_alloc/fasta_snip.core


Running with the -p option suggested that `gen' and `pick' allocate a lot of
memory throughout the run of the program (that memory is not retained).

I managed to confirm that for non-profiling builds by observing how the the
output of -sstderr changed when I modified `gen' to call itself fewer times.

This came as a surprise, because expected these two functions to be completely
allocation free, and the core does not suggest any allocation to me.

I would very much welcome explanations for these reported allocations.


Thank you,
Rohan Lean



More information about the Haskell-Cafe mailing list