|
7 | 7 |
|
8 | 8 | module Main where |
9 | 9 |
|
10 | | -import Data.Bifunctor (second) |
11 | 10 | import Control.DeepSeq (NFData) |
12 | 11 | import Control.Monad (replicateM) |
| 12 | +import Data.Bifunctor (second) |
13 | 13 | import Data.Bits (testBit) |
14 | 14 | import Data.HashMap.Strict (HashMap) |
15 | 15 | import qualified Data.HashMap.Strict as HM |
@@ -65,16 +65,14 @@ bInsert :: Benchmark |
65 | 65 | bInsert = |
66 | 66 | bgroup |
67 | 67 | "insert" |
68 | | - [ bgroup "presentKey" bInsertPresentKey, |
| 68 | + [ bgroup |
| 69 | + "presentKey" |
| 70 | + [ bgroup "sameValue" bInsertPresentKeySameValue, |
| 71 | + bgroup "differentValue" bInsertPresentKeyDifferentValue |
| 72 | + ], |
69 | 73 | bgroup "absentKey" bInsertAbsentKey |
70 | 74 | ] |
71 | 75 |
|
72 | | -bInsertPresentKey :: [Benchmark] |
73 | | -bInsertPresentKey = |
74 | | - [ bgroup "sameValue" bInsertPresentKeySameValue |
75 | | - , bgroup "differentValue" bInsertPresentKeyDifferentValue |
76 | | - ] |
77 | | - |
78 | 76 | bInsertPresentKeySameValue :: [Benchmark] |
79 | 77 | bInsertPresentKeySameValue = |
80 | 78 | [ bgroup'WithSizes sizes "Bytes" setupBytes b, |
@@ -103,7 +101,7 @@ bInsertPresentKeyDifferentValue = |
103 | 101 | b s = |
104 | 102 | bench (show s) |
105 | 103 | . whnf (\(m, kvs) -> foldl' (\() (k, v) -> HM.insert k v m `seq` ()) () kvs) |
106 | | - toKVs = take 100 . Data.List.cycle . map (second (+1)) . HM.toList |
| 104 | + toKVs = take 100 . Data.List.cycle . map (second (+ 1)) . HM.toList |
107 | 105 | setupBytes size gen = do |
108 | 106 | m <- genBytesMap size gen |
109 | 107 | return (m, toKVs m) |
|
0 commit comments