Skip to content

Commit 0ce66aa

Browse files
committed
add Merge micro benchmark cases for union merges
1 parent 7c2acd3 commit 0ce66aa

File tree

1 file changed

+40
-2
lines changed
  • bench/micro/Bench/Database/LSMTree/Internal

1 file changed

+40
-2
lines changed

bench/micro/Bench/Database/LSMTree/Internal/Merge.hs

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,39 @@ benchmarks = bgroup "Bench.Database.LSMTree.Internal.Merge" [
8484
randomWord64OutOf (totalEntries `div` 2)
8585
, mergeMappend = Just (onDeserialisedValues ((+) @Word64))
8686
}
87+
-- different merge types
8788
, benchMerge configWord64
88-
{ name = "word64-mix-x4"
89+
{ name = "word64-mix-collisions-x4-midlevel"
8990
, nentries = totalEntries `splitInto` 4
9091
, finserts = 1
9192
, fdeletes = 1
9293
, fmupserts = 1
94+
, randomKey = -- each run uses half of the possible keys
95+
randomWord64OutOf (totalEntries `div` 2)
96+
, mergeMappend = Just (onDeserialisedValues ((+) @Word64))
97+
, mergeType = MergeMidLevel
98+
}
99+
, benchMerge configWord64
100+
{ name = "word64-mix-collisions-x4-lastlevel"
101+
, nentries = totalEntries `splitInto` 4
102+
, finserts = 1
103+
, fdeletes = 1
104+
, fmupserts = 1
105+
, randomKey = -- each run uses half of the possible keys
106+
randomWord64OutOf (totalEntries `div` 2)
93107
, mergeMappend = Just (onDeserialisedValues ((+) @Word64))
108+
, mergeType = MergeLastLevel
94109
}
95110
, benchMerge configWord64
96-
{ name = "word64-mix-collisions-x4"
111+
{ name = "word64-mix-collisions-x4-union"
97112
, nentries = totalEntries `splitInto` 4
98113
, finserts = 1
99114
, fdeletes = 1
100115
, fmupserts = 1
101116
, randomKey = -- each run uses half of the possible keys
102117
randomWord64OutOf (totalEntries `div` 2)
103118
, mergeMappend = Just (onDeserialisedValues ((+) @Word64))
119+
, mergeType = MergeUnion
104120
}
105121
-- not writing anything at all
106122
, benchMerge configWord64
@@ -174,6 +190,20 @@ benchmarks = bgroup "Bench.Database.LSMTree.Internal.Merge" [
174190
, fdeletes = 1
175191
, mergeType = MergeLastLevel
176192
}
193+
, benchMerge configUTxOStaking
194+
{ name = "utxo-x2-tree-union" -- binary union merge
195+
, nentries = totalEntries `distributed` [4, 1]
196+
, mergeType = MergeUnion
197+
}
198+
, benchMerge configUTxOStaking
199+
{ name = "utxo-x10-tree-level" -- merge a whole table (for union)
200+
, nentries = totalEntries `distributed` [ 1, 1, 1
201+
, 4, 4, 4
202+
, 16, 16, 16
203+
, 100 -- last level
204+
]
205+
, mergeType = MergeLastLevel
206+
}
177207
]
178208
where
179209
totalEntries = 50_000
@@ -311,6 +341,14 @@ configUTxO = defaultConfig {
311341
, randomValue = first serialiseValue . uniform @_ @UTxOValue
312342
}
313343

344+
configUTxOStaking :: Config
345+
configUTxOStaking = defaultConfig {
346+
fmupserts = 1
347+
, randomKey = first serialiseKey . uniform @_ @UTxOKey
348+
, randomValue = first serialiseValue . uniform @_ @Word64
349+
, mergeMappend = Just (onDeserialisedValues ((+) @Word64))
350+
}
351+
314352
mergeEnv ::
315353
Config
316354
-> IO ( FilePath -- ^ Temporary directory

0 commit comments

Comments
 (0)