[Haskell-cafe] Memory problems reading a IntMap from a binary file
Don Stewart
dons at galois.com
Sun Aug 3 19:10:44 EDT 2008
lutzsteens:
> Hi,
>
> I have IntMap String with about 40,000 entries. After saving it to disk
> (via Data.Binary) the file is 3.5 Mb small. However if I load it and
> save it back again my program needs 180 MB memory. Is there anything I
> do wrong or does the map really need that much memory?
String can be really expensive. Try an IntMap ByteString
>
> The (simple) program I wrote:
>
> main =
> do
> mp <- decodeFile "i.bin" :: IO ( IntMap String )
> encodeFile "i2.bin" mp
> exitWith ExitSuccess
>
> Thanks,
> Ludger
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list