File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Control.Monad (replicateM)
1111import Data.Bits (testBit )
1212import Data.HashMap.Strict (HashMap )
1313import qualified Data.HashMap.Strict as HM
14+ import qualified Data.HashSet
1415import Data.Hashable
1516import Data.List
1617import Key.Bytes
@@ -21,9 +22,13 @@ import Prelude hiding (Foldable (..), lookup)
2122main :: IO ()
2223main =
2324 defaultMain
24- [ bFromList,
25- -- bgroup "insert" bInsert
26- bUnion
25+ [ bgroup
26+ " HashMap.Strict"
27+ [ bFromList,
28+ -- bgroup "insert" bInsert
29+ bUnion
30+ ],
31+ bgroup " HashSet" [bSetFromList]
2732 ]
2833
2934defaultGen :: StdGen
@@ -140,6 +145,23 @@ genInts ::
140145genInts n = do
141146 replicateM n . uniformM
142147
148+ bSetFromList :: Benchmark
149+ bSetFromList =
150+ bgroup
151+ " fromList"
152+ [ bgroup " Bytes" (b bytesEnv),
153+ bgroup " Int" (b intsEnv)
154+ ]
155+ where
156+ b e = [env (e s) (bench' s) | s <- defaultSizes]
157+ bench' s = bench (show s) . whnf Data.HashSet. fromList
158+ bytesEnv s = do
159+ g <- newIOGenM defaultGen
160+ genNBytes s bytesLength g
161+ intsEnv s = do
162+ g <- newIOGenM defaultGen
163+ genInts s g
164+
143165{-
144166bFromList = matrix defaultSizes e' b'
145167 where
You can’t perform that action at this time.
0 commit comments