Data.HashTable

Don Stewart dons at galois.com
Thu Mar 6 14:15:24 EST 2008


jmaessen:
> On Mar 6, 2008, at 9:28 AM, Johannes Waldmann wrote:
> 
> >Hello.
> >
> >When I insert 50 values in an empty hashtable,
> >I get longest chains of length 10. Like this:
> >
> >import Data.HashTable ( HashTable )
> >import qualified Data.HashTable as H
> >import System.Random
> >
> >main = do
> >   t <- H.new ( == ) H.hashInt
> >   sequence $ replicate 50 $ do
> >       x <- randomRIO ( 0 , 1000 )
> >       H.update t x ()
> >   lc <- H.longestChain t
> >   print lc
> >
> >output:
> >[(831,()),(346,()),(773,()),(475,()),(812,()),(307,()),(113,()),(637, 
> >()),(100,())]
> 
> The Data.HashTable code was tuned to favor relatively high bucket  
> loads.  Is that a good idea (I ask, having done some of this tuning  
> myself)?  It's been a long time since the code was re-tuned, and it's  
> likely some of the decisions ought to change in light of changes in  
> GHC's compiler, GC, and so forth.  At the moment:

After modifying it for the shootout, I noticed its missing a lot of
inline stuff (i.e. tends not to get inlined or specialised).

Needs a big overhaul.


More information about the Libraries mailing list