[Haskell-cafe] Why does this program eat RAM?

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Tue Sep 5 04:24:57 EDT 2006


Donald Bruce Stewart wrote:
> A quick hack up to use Data.ByteString uses a lot less ram, though
> profiling still shows 95% of time spent in the building the Map.

Nice!

>           k n w = Map.insertWith f w 1 n
>           f _ x = let y = x + 1 in y `seq` y

y `seq` y is semantically equivalent to y though. The strictness
would have to be built into insertWith to make this work.

regards,

Bertram


More information about the Haskell-Cafe mailing list