Memory problems reading a IntMap from a binary file

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? The (simple) program I wrote: main = do mp <- decodeFile "i.bin" :: IO ( IntMap String ) encodeFile "i2.bin" mp exitWith ExitSuccess Thanks, Ludger

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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Don Stewart
-
Ludger Steens