Ketil Malde wrote:
> Ketil Malde <[EMAIL PROTECTED]> 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
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to