Fwd: [Haskell-cafe] implementing python-style dictionary in Haskell
Alberto G. Corona
agocorona at gmail.com
Tue Nov 18 16:42:49 EST 2008
sorry, Dons,
---------- Forwarded message ----------
From: Alberto G. Corona <agocorona at gmail.com>
Date: 2008/11/18
Subject: Re: [Haskell-cafe] implementing python-style dictionary in Haskell
To: Don Stewart <dons at galois.com>
By the way byteStrings are wonderful, but, it isn´t true that byteStrings
are not so fast for managing short strings, for example keys ?
2008/11/18 Don Stewart <dons at galois.com>
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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081118/bebc6a92/attachment.htm
More information about the Haskell-Cafe
mailing list