[Haskell-cafe] OCaml list sees abysmal Language Shootout results

Greg Buchholz haskell at sleepingsquirrel.org
Wed Oct 6 14:04:07 EDT 2004


Ketil Malde wrote:
> Ketil Malde <ketil+haskell at ii.uib.no> writes:
> 
> > To get memory consumption down, I tried a strict "update" function:
> 
> >    update k fm = let x = (get hash1 k + get fm k) 
> >                  in x `seq` addToFM fm k x
> 
> > which slowed the program down(!), 

    Yes that fixes(?) it.  The strict update removes the space leak and
makes the FiniteMap perform as expected.

> 
> I wonder if this isn't due to never evaluating the values for
> "foo_2" to "foo_9998" because of laziness?

    Maybe. On a whim I thought that maybe unevaluated addition thunks
from addToFM_C were piling up, so I changed to addListToFM_C instead...

 let update k fm = addListToFM_C (+) fm $ replicate (read n) (k,gethash1 k) 
 let res = foldr update hash2 keys

...but that hardly made a difference.  So the search continues.


Greg Buchholz


More information about the Haskell-Cafe mailing list