Skip to content

Commit 35d7d03

Browse files
committed
Remove judy
1 parent 2bbc950 commit 35d7d03

File tree

5 files changed

+17
-47
lines changed

5 files changed

+17
-47
lines changed

Common.hs

-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Control.DeepSeq
55
import qualified Data.HashTable.ST.Basic
66
import qualified Data.HashTable.ST.Cuckoo
77
import qualified Data.HashTable.ST.Linear
8-
import qualified Data.Judy
98

109

1110
instance NFData (Data.HashTable.ST.Basic.HashTable s k v) where
@@ -16,12 +15,3 @@ instance NFData (Data.HashTable.ST.Cuckoo.HashTable s k v) where
1615

1716
instance NFData (Data.HashTable.ST.Linear.HashTable s k v) where
1817
rnf x = seq x ()
19-
20-
instance NFData (Data.Judy.JudyL v) where
21-
rnf x = seq x ()
22-
23-
judyFromList :: [(Int,Int)] -> IO (Data.Judy.JudyL Int)
24-
judyFromList xs = do
25-
j <- Data.Judy.new
26-
mapM_ (\(k,v) -> Data.Judy.insert (fromIntegral k) v j) xs
27-
return j

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# dictionaries
22

3-
Benchmarks for dictionary data structures: hash tables, maps, tries, etc.
3+
Benchmarks for dictionary data structures: hash tables, maps, tries,
4+
etc.
5+
6+
The `judy` package was removed from this test suite for instability;
7+
it segfaults the program.
48

59
## Running
610

Space.hs

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import qualified Data.HashMap.Strict
1212
import qualified Data.HashTable.IO
1313
import qualified Data.IntMap.Lazy
1414
import qualified Data.IntMap.Strict
15-
import qualified Data.Judy
1615
import qualified Data.Map.Lazy
1716
import qualified Data.Map.Strict
1817
import System.Random
@@ -60,4 +59,3 @@ fromlists =
6059
io "Data.HashTable.IO.LinearHashTable (1 million)"
6160
(Data.HashTable.IO.fromList :: [(Int,Int)] -> IO (Data.HashTable.IO.LinearHashTable Int Int))
6261
elems
63-
io "Data.Judy" judyFromList elems

Time.hs

+12-32
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
module Main (main) where
77

8-
import Common
8+
import Common ()
99
import Control.Arrow
1010
import Control.DeepSeq
1111
import Control.Monad
@@ -19,7 +19,6 @@ import qualified Data.HashTable.Class
1919
import qualified Data.HashTable.IO
2020
import qualified Data.IntMap.Lazy
2121
import qualified Data.IntMap.Strict
22-
import qualified Data.Judy
2322
import qualified Data.Map.Lazy
2423
import qualified Data.Map.Strict
2524
import Data.Maybe (isJust)
@@ -96,7 +95,6 @@ main = do
9695
"Data.HashTable.IO.CuckooHashTable"
9796
Data.HashTable.IO.new
9897
insertHashTableIOCuckoo
99-
, InsertIntIO "Data.Judy" Data.Judy.new insertJudy
10098
])
10199
, bgroup
102100
"Intersection (Randomized)"
@@ -141,7 +139,7 @@ main = do
141139
"Data.HashTable.IO.CuckooHashTable"
142140
Data.HashTable.IO.fromList
143141
intersectionHashTableIOCuckoo
144-
, IntersectionIO "Data.Judy" judyFromList intersectionJudy
142+
145143
])
146144
, bgroup
147145
"Lookup Int (Randomized)"
@@ -183,7 +181,7 @@ main = do
183181
"Data.HashTable.IO.CuckooHashTable"
184182
(Data.HashTable.IO.fromList :: [(Int, Int)] -> IO (Data.HashTable.IO.CuckooHashTable Int Int))
185183
Data.HashTable.IO.lookup
186-
, LookupIO "Data.Judy" judyFromList judyLookup
184+
187185
])
188186
, bgroup
189187
"FromList ByteString (Monotonic)"
@@ -251,7 +249,7 @@ main = do
251249
[ env
252250
(let !elems =
253251
force (zip (randoms (mkStdGen 0) :: [Int]) [1 :: Int .. i])
254-
in pure elems)
252+
in pure elems)
255253
(\_ -> bench (title ++ ":" ++ show i) $ nf func i)
256254
| i <- [10, 100, 1000, 10000]
257255
, InsertInt title func <- funcs
@@ -267,7 +265,7 @@ main = do
267265
force
268266
( build (zip (randoms (mkStdGen 0) :: [Int]) [1 :: Int .. i])
269267
, build (zip (randoms (mkStdGen 1) :: [Int]) [1 :: Int .. i]))
270-
in pure args)
268+
in pure args)
271269
(\args -> bench (title ++ ":" ++ show i) $ nf (uncurry intersect) args)
272270
| i <- [10, 100, 1000, 10000, 100000, 1000000]
273271
, Intersection title build intersect <- funcs
@@ -288,7 +286,7 @@ main = do
288286
(map
289287
(first (S8.pack . show))
290288
(take i (zip (randoms (mkStdGen 0) :: [Int]) [1 ..])))
291-
in pure elems)
289+
in pure elems)
292290
(\elems -> bench (title ++ ":" ++ show i) $ nf func elems)
293291
| i <- [10, 100, 1000, 10000]
294292
, FromListBS title func <- funcs
@@ -298,7 +296,7 @@ main = do
298296
(let list = take i (zip (randoms (mkStdGen 0) :: [Int]) [1 ..])
299297
(!key, _) = list !! (div i 2)
300298
!elems = force (fromList list)
301-
in pure (elems, key))
299+
in pure (elems, key))
302300
(\(~(elems, key)) ->
303301
bench (title ++ ":" ++ show i) $ nf (flip func elems) key)
304302
| i <- [10, 100, 1000, 10000, 100000, 1000000]
@@ -313,7 +311,7 @@ main = do
313311
(take i (zip [1 :: Int ..] [1 ..])))
314312
(!key, _) = list !! (div i 2)
315313
!elems = force (fromList list)
316-
in pure (elems, key))
314+
in pure (elems, key))
317315
(\(~(elems, key)) ->
318316
bench (title ++ ":" ++ show i) $ nf (flip func elems) key)
319317
| i <- [10000]
@@ -328,7 +326,7 @@ main = do
328326
(take i (zip (randoms (mkStdGen 0) :: [Int]) [1 ..])))
329327
(!key, _) = list !! (div i 2)
330328
!elems = force (fromList list)
331-
in pure (elems, key))
329+
in pure (elems, key))
332330
(\(~(elems, key)) ->
333331
bench (title ++ ":" ++ show i) $ nf (flip func elems) key)
334332
| i <- [10000]
@@ -338,8 +336,8 @@ main = do
338336
[ env
339337
(let list = take i (zip (randoms (mkStdGen 0) :: [Int]) [1 ..])
340338
(!key, _) = list !! (div i 2)
341-
in do !elems <- fmap force (fromList list)
342-
pure (elems, key))
339+
in do !elems <- fmap force (fromList list)
340+
pure (elems, key))
343341
(\(~(elems, key)) ->
344342
bench (title ++ ":" ++ show i) $ nfIO (func elems key))
345343
| i <- [10, 100, 1000, 10000, 100000, 1000000]
@@ -352,7 +350,7 @@ main = do
352350
(map
353351
(first (S8.pack . show))
354352
(take i (zip [1 :: Int ..] [1 ..])))
355-
in pure elems)
353+
in pure elems)
356354
(\elems -> bench (title ++ ":" ++ show i) $ nf func elems)
357355
| i <- [10000]
358356
, FromListBS title func <- funcs
@@ -420,24 +418,6 @@ insertHashTableIOLinear :: Data.HashTable.IO.LinearHashTable Int Int
420418
-> IO (Data.HashTable.IO.LinearHashTable Int Int)
421419
insertHashTableIOLinear = insertHashTableIO
422420

423-
insertJudy :: Data.Judy.JudyL Int -> Int -> IO (Data.Judy.JudyL Int)
424-
insertJudy j n0 = do
425-
mapM_ (\n -> Data.Judy.insert (fromIntegral n) n j) [1 .. n0]
426-
return j
427-
428-
judyLookup :: Data.Judy.JudyL Int -> Int -> IO (Maybe Int)
429-
judyLookup j k = Data.Judy.lookup (fromIntegral k) j
430-
431-
intersectionJudy :: Data.Judy.JudyL Int -> Data.Judy.JudyL Int -> IO (Data.Judy.JudyL Int)
432-
intersectionJudy ij0 ij1 = do
433-
j <- Data.Judy.new
434-
j0 <- Data.Judy.freeze ij0
435-
j0Kvs <- Data.Judy.toList j0
436-
mapM_ (\(k,v) ->
437-
Data.Judy.member k ij1
438-
>>= \found -> when found (Data.Judy.insert k v j)) j0Kvs
439-
return j
440-
441421
intersectionHashTableIO :: Data.HashTable.Class.HashTable ht
442422
=> Data.HashTable.IO.IOHashTable ht Int Int
443423
-> Data.HashTable.IO.IOHashTable ht Int Int

bench.cabal

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ test-suite space
2121
, bytestring-trie
2222
, random
2323
, hashtables
24-
, judy
2524

2625
benchmark time
2726
default-language: Haskell2010
@@ -39,7 +38,6 @@ benchmark time
3938
, bytestring-trie
4039
, random, directory
4140
, hashtables
42-
, judy
4341

4442
executable report
4543
default-language: Haskell2010

0 commit comments

Comments
 (0)