Skip to content

Commit 71fe4bc

Browse files
committed
small tweaks for micro benchmarks
A quick follow-up to #538
1 parent 95ab06a commit 71fe4bc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ randomEntry :: StdGen -> (Entry UTxOValue ByteString, StdGen)
252252
randomEntry g = frequency [
253253
(20, \g' -> let (!v, !g'') = uniform g' in (Insert v, g''))
254254
, (1, \g' -> let (!v, !g'') = uniform g'
255-
(!b, !g''') = randomByteStringR (0, 2000) g'' -- < 2kB
255+
-- The size of the blobs doesn't matter for the benchmark,
256+
-- as it only deals with the blob references. So we make
257+
-- them tiny to not slow down the setup.
258+
(!b, !g''') = randomByteStringR (0, 100) g''
256259
in (InsertWithBlob v b, g'''))
257260
, (2, \g' -> let (!v, !g'') = uniform g' in (Mupdate v, g''))
258261
, (2, \g' -> (Delete, g'))

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,10 @@ benchMerge conf@Config{name} =
231231
-- thread `runs` through the environment, too.
232232
-- 2. It forces the result to normal form, which would traverse the
233233
-- whole run, so we force to WHNF ourselves and just return `()`.
234-
235-
-- We make sure to immediately close resulting runs so we don't run
236-
-- out of file handles or disk space. However, we don't want it to
237-
-- be part of the measurement, as it includes deleting files.
238-
-- Therefore, ... TODO
234+
-- 3. It doesn't have access to the run we created in the benchmark,
235+
-- but the cleanup should not be part of the measurement, as it
236+
-- includes deleting files. So we smuggle the reference out using
237+
-- an `IORef`.
239238
Cr.perRunEnvWithCleanup
240239
((runs,) <$> newIORef Nothing)
241240
(releaseRun . snd) $ \(runs', ref) -> do

0 commit comments

Comments
 (0)