on master help sign in
Add "concurrent" benchmark to charting/bench-show
commit1266a13e0e8cd78ae7396da60aa19211cfe54948 authorHarendra Kumar <harendra.kumar@gmail.com> dateWed 16 Oct 2019, 14:24 (7 years ago) parent0e98baf
2 files changed+35−17
bench.sh+24−17 benchmark/Chart.hs+11
bench.sh+24−17
@@ -2,7 +2,7 @@
22
33print_help () {
44 echo "Usage: $0 "
5− echo " [--benchmarks <all|linear|linear-async|linear-rate|nested|fileio|array|base>]"
5+ echo " [--benchmarks <all|linear|linear-async|linear-rate|nested|concurrent|fileio|array|base>]"
66 echo " [--group-diff]"
77 echo " [--graphs]"
88 echo " [--no-measure]"
@@ -231,7 +231,7 @@ run_reports() {
231231#-----------------------------------------------------------------------------
232232
233233DEFAULT_BENCHMARKS="linear"
234−ALL_BENCHMARKS="linear linear-async linear-rate nested fileio array base"
234+ALL_BENCHMARKS="linear linear-async linear-rate nested concurrrent fileio array base"
235235GROUP_DIFF=0
236236
237237COMPARE=0
@@ -254,21 +254,6 @@ cabal_which() {
254254 find dist-newstyle -type f -path "*${GHC_VERSION}*/$1"
255255}
256256
257−if test "$USE_STACK" = "1"
258−then
259− WHICH_COMMAND="stack exec which"
260− BUILD_CHART_EXE="stack build --flag streamly:dev"
261− GET_BENCH_PROG=stack_bench_prog
262− BUILD_BENCH="stack build $STACK_BUILD_FLAGS --flags "streamly:benchmark" --bench --no-run-benchmarks"
263−else
264− # XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
265− #WHICH_COMMAND="cabal v2-exec which"
266− WHICH_COMMAND=cabal_which
267− BUILD_CHART_EXE="cabal v2-build --flags dev chart"
268− GET_BENCH_PROG=cabal_bench_prog
269− BUILD_BENCH="cabal v2-build $CABAL_BUILD_FLAGS --flag benchmark --enable-benchmarks"
270−fi
271−
272257#-----------------------------------------------------------------------------
273258# Read command line
274259#-----------------------------------------------------------------------------
@@ -305,6 +290,27 @@ then
305290 CABAL_BUILD_FLAGS="--flags dev"
306291fi
307292
293+if echo "$BENCHMARKS" | grep -q concurrent
294+then
295+ STACK_BUILD_FLAGS="--flag streamly:dev"
296+ CABAL_BUILD_FLAGS="--flags dev"
297+fi
298+
299+if test "$USE_STACK" = "1"
300+then
301+ WHICH_COMMAND="stack exec which"
302+ BUILD_CHART_EXE="stack build --flag streamly:dev"
303+ GET_BENCH_PROG=stack_bench_prog
304+ BUILD_BENCH="stack build $STACK_BUILD_FLAGS --flags "streamly:benchmark" --bench --no-run-benchmarks"
305+else
306+ # XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
307+ #WHICH_COMMAND="cabal v2-exec which"
308+ WHICH_COMMAND=cabal_which
309+ BUILD_CHART_EXE="cabal v2-build --flags dev chart"
310+ GET_BENCH_PROG=cabal_bench_prog
311+ BUILD_BENCH="cabal v2-build $CABAL_BUILD_FLAGS --flag benchmark --enable-benchmarks"
312+fi
313+
308314#-----------------------------------------------------------------------------
309315# Build stuff
310316#-----------------------------------------------------------------------------
@@ -319,6 +325,7 @@ build_report_progs "$BENCHMARKS"
319325
320326if test "$MEASURE" = "1"
321327then
328+ echo $BUILD_BENCH
322329 $BUILD_BENCH || die "build failed"
323330 run_measurements "$BENCHMARKS"
324331fi
benchmark/Chart.hs+11
@@ -30,6 +30,7 @@ data BenchType
3030 | Base
3131 | FileIO
3232 | Array
33+ | Concurrent
3334 deriving Show
3435
3536data Options = Options
@@ -71,6 +72,7 @@ parseBench = do
7172 Just "base" -> setBenchType Base
7273 Just "fileio" -> setBenchType FileIO
7374 Just "array" -> setBenchType Array
75+ Just "concurrent" -> setBenchType Concurrent
7476 Just str -> do
7577 liftIO $ putStrLn $ "unrecognized benchmark type " <> str
7678 mzero
@@ -245,6 +247,10 @@ makeArrayGraphs :: Config -> String -> IO ()
245247makeArrayGraphs cfg@Config{..} inputFile =
246248 ignoringErr $ graph inputFile "array" cfg
247249
250+makeConcurrentGraphs :: Config -> String -> IO ()
251+makeConcurrentGraphs cfg@Config{..} inputFile =
252+ ignoringErr $ graph inputFile "concurrent" cfg
253+
248254------------------------------------------------------------------------------
249255-- Reports/Charts for base streams
250256------------------------------------------------------------------------------
@@ -353,6 +359,11 @@ main = do
353359 makeArrayGraphs
354360 "charts/array/results.csv"
355361 "charts/array"
362+ Concurrent -> benchShow opts cfg
363+ { title = Just "Concurrent Ops" }
364+ makeConcurrentGraphs
365+ "charts/concurrent/results.csv"
366+ "charts/concurrent"
356367 Base -> do
357368 let cfg' = cfg { title = Just "100,000 elems" }
358369 if groupDiff