Skip to content

Data.HashTable is slow

Data.HashTable is slow. Implement something non-naive, and move it out of base. It's a bit embarassing. See e.g.

import Prelude hiding (lookup)
import Data.HashTable (hashInt, fromList, lookup)

n :: Int
n = 10000000

l :: [Int]
l = [1..n]

stream :: [(Int, Int)]
stream = zip l l

main = do
   m <- fromList hashInt stream
   v <- lookup m 100
   print v

Maybe just port the OCaml standard hashtable?

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information