[Haskell-cafe] ~1k memory per elem for FiniteMap!!!?

S. Alexander Jacobson alex at alexjacobson.com
Tue Jan 25 12:41:26 EST 2005


Is it possible/reasonable that Data.FiniteMap 
takes around 1k per element?

I just profiled this code:

    import Data.FiniteMap

    zipped =zip [1..] [1..50000]
    addFMItem (index,item) fm  = (addToFM $! fm) item index
    produce = foldr addFMItem emptyFM zipped
    fm = take 1 $ keysFM produce
    main = print $ fm

And it apparently consumes more than 45MB of heap 
and won't run unless I give it at least 3M of 
stack space.

I assume I doing something wrong here, but have 
no idea what it is.

-Alex-

______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com


More information about the Haskell-Cafe mailing list