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

John Goerzen jgoerzen at complete.org
Tue Sep 5 11:13:51 EDT 2006


On 2006-09-05, Udo Stenzel <u.stenzel at web.de> wrote:
> The culprit is insertWith, it inserts unevaluated thunks into your map

This turned out to be the answer -- thanks!

I posted a new version of the code here:

http://changelog.complete.org/posts/536-Another-Haskell-Solution-to-Lars-Problem.html

This particular test set was a few hundred copies of the GPL.  So the
Map was fairly small, since each word occured many, many times -- but
there weren't a whole lot of words.  So the problem was not the
inefficiency of Data.Map, nor the inefficiency of Strings (though that
inefficiency does explain why the Python solution is faster, I'm sure).

-- John




More information about the Haskell-Cafe mailing list