[Haskell-cafe] Slow IO

Ketil Malde ketil+haskell at ii.uib.no
Thu Sep 14 03:34:36 EDT 2006

Daniel Fischer <daniel.is.fischer at web.de> writes:

> Yes, I did it wrong, but I didn't keep anything (but the first and last Char 
> of each line) in memory on purpose. I hoped for the lines to be read one 
> after the other, head and last extracted 
> Profiling (hy,hc) shows that the IO part of the programme holds on to tons of 
> lists - that couldn't be anything but parts of the file-contents, I believe.

Chances are that you don't evaluate these characters right away, so
what you are retaining is just unevaluated thunks that refer to the
lines themselves.  So the fix is to make the extraction of the
characters stricter.

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list