summary of storing highly shared data structures
Christian Maeder
maeder at tzi.de
Wed Jan 11 15:03:53 EST 2006
Hi Bulat,
The difference between IntMap and HashTable is not large despite -A10m
(without this option HashTable is unusable).
HashTable:
<<ghc: 2754665792 bytes, 287 GCs, 26495315/147911940 avg/max bytes
residency (12 samples), 299M in use, 0.00 INIT (0.00 elapsed), 31.72 MUT
(33.78 elapsed), 14.04 GC (17.73 elapsed) :ghc>>
IntMap:
<<ghc: 2705137096 bytes, 282 GCs, 30775754/176806684 avg/max bytes
residency (12 samples), 356M in use, 0.00 INIT (0.01 elapsed), 30.35 MUT
(31.28 elapsed), 13.64 GC (14.52 elapsed) :ghc>>
I must admit, though, that my hash function may be bad:
data EqKey = EqKey (StableName ()) TypeRep deriving Eq
hashKey :: EqKey -> Int32
hashKey (EqKey p t) = HTab.hashInt (hashStableName p)
and calling "HashTable.new (==) hashKey". (Adding hashString on show
<TypeRep> is worse.) A hash-function for TypeReps would be better.
But my IntMap also uses Eq on EqKey ("IntMap [(EqKey, Int)]")
Cheers Christian
Bulat Ziganshin wrote:
> Hello Christian,
>
> Wednesday, January 11, 2006, 5:13:25 PM, you wrote:
>
> CM> It turned out that the IntMap was not slower than the HashTable (What is
> CM> HashTable good for, then? Why is it so slow?)
>
> see the http://cvs.haskell.org/trac/ghc/ticket/650
>
> and the attached letter. "-A10m" should help in this case
>
>
More information about the Glasgow-haskell-users
mailing list