[Haskell-cafe] implementing python-style dictionary in Haskell

Don Stewart dons at galois.com
Tue Nov 18 15:52:38 EST 2008


dave:
> 2008/11/18 kenny lu <haskellmail at gmail.com>:
> > Here is a comparison of memory usage
> >
> > Map     : 345 MB
> > IntMap : 146 MB
> > Trie     : 282 MB
> > Python : 94 MB
> >
> > Here is a comparison of execution time (on an intel dual core 2.0G)
> >
> > Map: 26 sec
> > IntMap: 9 sec
> > Trie: 12 sec
> > Python: 2.24 sec
> >
> >
> > The above number shows that my implementations of python style dictionary
> > are space/time in-efficient as compared to python.
> >
> > Can some one point out what's wrong with my implementations?
> 
> This isn't really a fair comparison. Map, IntMap, and Trie are
> persistent data structures, and Python dictionaries are ephemeral.
> (That is, when you "add" a key to a Map, you actually create a new one
> that shares structure with the old one, and both can be used in
> subsequent code. In Python, you would have to copy the dictionary.)
> 

Strings, not ByteStrings. that's the difference.

-- Don


More information about the Haskell-Cafe mailing list