[Haskell-cafe] Re: Difficult memory leak in array processing
duncan.coutts at worc.ox.ac.uk
Wed Nov 29 20:25:42 EST 2006
On Wed, 2006-11-29 at 20:27 +0100, apfelmus at quantentunnel.de wrote:
> On the implementation level, lazy evaluation is in the way when
> crunching bytes.
Something I rather enjoyed when hacking on the ByteString lib is finding
that actually lazy evaluation is great when crunching bytes, though you
do need to know exactly when to use it.
Lazy ByteStrings rely on lazy evaluation of course. Demanding a lazy
ByteString alternates between strictly filling in big chunks of data in
memory with lazily suspending before producing the next chunk.
As many people have observed before, FP optimisation is to a great
extent about thinking more carefully about a better evaluation order for
a computation and making some bits stricter and some bits lazier to get
that better evaluation order.
More information about the Haskell-Cafe