Skip to content

Commit 09f06ae

Browse files
dcouttsjorisdral
authored andcommitted
WP8 benchmark: use small merge batch size in pipelined mode
This now gets real parallel speedups on the WP8 benchmark in pipelined mode. On my laptop, we get: * non-pipelined mode: 86.5k * before: pipelined mode (2 cores): 92.2k * after: pipelined mode (2 cores): 120.0k In part this is because pipelined mode on 1 core is a regression: 70.1k because it has to do strictly more work, and it avoids doing any batching which normally improves performance.
1 parent cc50eb7 commit 09f06ae

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

bench/macro/lsm-tree-bench-wp8.hs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,23 @@ mkTableConfigSetup GlobalOpts{diskCachePolicy} SetupOpts{bloomFilterAlloc} conf
180180
, LSM.confBloomFilterAlloc = bloomFilterAlloc
181181
}
182182

183-
mkTableConfigRun :: GlobalOpts -> LSM.TableConfig -> LSM.TableConfig
184-
mkTableConfigRun GlobalOpts{diskCachePolicy} conf = conf {
185-
LSM.confDiskCachePolicy = diskCachePolicy
183+
mkTableConfigRun :: GlobalOpts -> RunOpts -> LSM.TableConfig -> LSM.TableConfig
184+
mkTableConfigRun GlobalOpts{diskCachePolicy} RunOpts {pipelined} conf =
185+
conf {
186+
LSM.confDiskCachePolicy = diskCachePolicy,
187+
LSM.confMergeBatchSize = if pipelined
188+
then LSM.MergeBatchSize 1
189+
else LSM.confMergeBatchSize conf
186190
}
187191

188-
mkOverrideDiskCachePolicy :: GlobalOpts -> LSM.TableConfigOverride
189-
mkOverrideDiskCachePolicy GlobalOpts{diskCachePolicy} =
190-
LSM.noTableConfigOverride {
191-
LSM.overrideDiskCachePolicy = Just diskCachePolicy
192-
}
192+
mkTableConfigOverride :: GlobalOpts -> RunOpts -> LSM.TableConfigOverride
193+
mkTableConfigOverride GlobalOpts{diskCachePolicy} RunOpts {pipelined} =
194+
LSM.noTableConfigOverride {
195+
LSM.overrideDiskCachePolicy = Just diskCachePolicy,
196+
LSM.overrideMergeBatchSize = if pipelined
197+
then Just (LSM.MergeBatchSize 1)
198+
else Nothing
199+
}
193200

194201
mkTracer :: GlobalOpts -> Tracer IO LSM.LSMTreeTrace
195202
mkTracer gopts
@@ -585,9 +592,9 @@ doRun gopts opts = do
585592
-- reference version starts with empty (as it's not practical or
586593
-- necessary for testing to load the whole snapshot).
587594
tbl <- if check opts
588-
then let conf = mkTableConfigRun gopts benchTableConfig
595+
then let conf = mkTableConfigRun gopts opts benchTableConfig
589596
in LSM.newTableWith @IO @K @V @B conf session
590-
else let conf = mkOverrideDiskCachePolicy gopts
597+
else let conf = mkTableConfigOverride gopts opts
591598
in LSM.openTableFromSnapshotWith @IO @K @V @B conf session name label
592599

593600
-- In checking mode, compare each output against a pure reference.

0 commit comments

Comments
 (0)