[Haskell-cafe] Comments and suggestions on code
andre at digirati.com.br
Sat Jan 12 10:19:28 EST 2008
On Fri, 2008-01-11 at 19:14 -0800, Jonathan Cast wrote:
> These are all known and expected. As I said, you can expect lazy
> versions to normally be slower than explicit loops. The question is
> whether 50% more time and 300% more memory has a higher cost in your
> case than the extra complexity and reduced modularity of the lazy code.
I think I understand... I expected the getDirectoryContents + mapM_ to
have about the same memory usage of the readDirStream version, because
getDirectoryContents would lazily give me one entry at a time, but the
list of entries returned by it ends up being created anyway, hence the
larger memory usage, as the readDirStream version never builds a list.
More information about the Haskell-Cafe