From 810c64358f9e5a73d8f5722a02f807dd316c58af Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Mon, 31 Jul 2023 14:58:13 +0200 Subject: [PATCH] Separate primary and extra countdown benchmarks --- effectful/bench/Main.hs | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/effectful/bench/Main.hs b/effectful/bench/Main.hs index 79d6f3c..5bac5d9 100644 --- a/effectful/bench/Main.hs +++ b/effectful/bench/Main.hs @@ -20,18 +20,13 @@ main = defaultMain [ concurrencyBenchmark , unliftBenchmark , bgroup "countdown" $ map countdown [1000, 2000, 3000] - , bgroup "filesize" $ map filesize [1000, 2000, 3000] + , bgroup "countdown (extra)" $ map countdownExtra [1000, 2000, 3000] + , bgroup "filesize" $ map filesize [1000, 2000, 3000] ] -countdown :: Integer -> Benchmark -countdown n = bgroup (show n) - [ bench "reference (pure)" $ nf countdownRef n - , bench "reference (ST)" $ nf countdownST n - , bgroup "effectful (local/static)" - [ bench "shallow" $ nf countdownEffectfulLocal n - , bench "deep" $ nf countdownEffectfulLocalDeep n - ] - , bgroup "effectful (local/static/state)" +countdownExtra :: Integer -> Benchmark +countdownExtra n = bgroup (show n) + [ bgroup "effectful (local/static/state)" [ bench "shallow" $ nf countdownEffectfulLocalSt n , bench "deep" $ nf countdownEffectfulLocalDeepSt n ] @@ -39,14 +34,28 @@ countdown n = bgroup (show n) [ bench "shallow" $ nf countdownEffectfulLocalStM n , bench "deep" $ nf countdownEffectfulLocalDeepStM n ] - , bgroup "effectful (local/dynamic)" - [ bench "shallow" $ nf countdownEffectfulDynLocal n - , bench "deep" $ nf countdownEffectfulDynLocalDeep n - ] , bgroup "effectful (local/dynamic/double)" [ bench "shallow" $ nf countdownEffectfulDoubleDynLocal n , bench "deep" $ nf countdownEffectfulDoubleDynLocalDeep n ] + , bgroup "effectful (shared/dynamic/double)" + [ bench "shallow" $ nf countdownEffectfulDoubleDynShared n + , bench "deep" $ nf countdownEffectfulDoubleDynSharedDeep n + ] + ] + +countdown :: Integer -> Benchmark +countdown n = bgroup (show n) + [ bench "reference (pure)" $ nf countdownRef n + , bench "reference (ST)" $ nf countdownST n + , bgroup "effectful (local/static)" + [ bench "shallow" $ nf countdownEffectfulLocal n + , bench "deep" $ nf countdownEffectfulLocalDeep n + ] + , bgroup "effectful (local/dynamic)" + [ bench "shallow" $ nf countdownEffectfulDynLocal n + , bench "deep" $ nf countdownEffectfulDynLocalDeep n + ] , bgroup "effectful (shared/static)" [ bench "shallow" $ nf countdownEffectfulShared n , bench "deep" $ nf countdownEffectfulSharedDeep n @@ -55,10 +64,6 @@ countdown n = bgroup (show n) [ bench "shallow" $ nf countdownEffectfulDynShared n , bench "deep" $ nf countdownEffectfulDynSharedDeep n ] - , bgroup "effectful (shared/dynamic/double)" - [ bench "shallow" $ nf countdownEffectfulDoubleDynShared n - , bench "deep" $ nf countdownEffectfulDoubleDynSharedDeep n - ] #ifdef VERSION_cleff , bgroup "cleff (local)" [ bench "shallow" $ nf countdownCleffLocal n