[Haskell-cafe] g++ std:map vs GHC IntMap

Manlio Perillo manlio_perillo at libero.it
Thu Mar 26 11:39:12 EDT 2009


Hi.

I have tried to compare performance of the g++ std::map versus the GHC 
IntMap.

The test consists in adding 10000000 elements to an empty map.

Haskell code is here:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2899

C++ code is here:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2900


The execution time and CPU usage is almost the same.
However the C++ version requires 305 MB, the GHC version 617 MB.

gcc 4.3.2
ghc 6.8.2
on Debian Linux Lenny, i386.


Isn't really possible to optimize memory usage in cases like this?


I also tried with Data.HashTable:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2902

but memory usage is 703 MB, and execution time is about 4.5 times slower!


Thanks  Manlio Perillo




More information about the Haskell-Cafe mailing list