[Shootout-list] ghc && strictness && hashes

Brent Fulgham bfulg@pacbell.net
Wed, 06 Oct 2004 22:04:00 -0700


On 2004-10-06 16:21:32 -0700 Greg Buchholz 
<sleepingsquirrel@yahoo.com> wrote:

>   There seems to be a little bit of a bug in the ghc version of
> "Hashes, part II".  Because Haskell is lazy by default, the
> FiniteMaps (hashes) don't actually get fully populated (because
> they're never used).  Instead of measuring how long it takes to do
> a number of hash insertions, what we're measuring is how fast we
> can throw a bunch of unevaluated thunks onto the heap.  That's
> also why the current program consumes a whopping 109MB.  I've
> attached a program to cure this problem, unfortunately it runs
> slower than the original.  The key to getting the FiniteMaps
> populated is the strictness provided by the 'seq' operator (thanks
> to Ketil Malde).  If anyone has any further ideas I'd be
> interested in hearing them.

Applied.  Thanks for the correction.

-Brent