on master help sign in
update missing benchmarks, support benchmark groups

Support running groups of benchmarks e.g. ARRAY/SERIAL/CONCURRENT Add missing array benchmarks and "parallel" benchmark For "--long" case run only INFINITE stream benchmarks

commit2604246b63c2faa1a0070e3a174fbc95cae750f4 authorHarendra Kumar <harendra.kumar@gmail.com> dateThu 13 Feb 2020, 13:49 (7 years ago) parente90c0fa
2 files changed+75−14
bench.sh+43−10 benchmark/Chart.hs+32−4
bench.sh+43−10
@@ -1,10 +1,27 @@
11#!/bin/bash
22
3−ALL_BENCHMARKS="linear linear-async linear-rate nested nested-concurrent nested-unfold concurrent fileio array base"
3+DEV_BENCHMARKS="concurrent base adaptive"
4+SERIAL_BENCHMARKS="linear linear-rate nested nested-unfold"
5+# parallel benchmark-suite is separated because we run it with a higher
6+# heap size limit.
7+CONCURRENT_BENCHMARKS="linear-async nested-concurrent parallel"
8+ARRAY_BENCHMARKS="array unpinned-array prim-array small-array"
9+
10+INFINITE_BENCHMARKS="$SERIAL_BENCHMARKS linear-async nested-concurrent"
11+FINITE_BENCHMARKS="$ARRAY_BENCHMARKS fileio parallel"
12+
13+ALL_BENCHMARKS="$SERIAL_BENCHMARKS $CONCURRENT_BENCHMARKS $ARRAY_BENCHMARKS $DEV_BENCHMARKS"
14+
15+list_benches () {
16+ for i in $ALL_BENCHMARKS
17+ do
18+ echo -n "|$i"
19+ done
20+}
421
522print_help () {
623 echo "Usage: $0 "
7− echo " [--benchmarks <all|linear|linear-async|linear-rate|nested|nested-concurrent|nested-unfold|concurrent|fileio|array|base>]"
24+ echo " [--benchmarks <ALL|SERIAL|CONCURRENT|ARRAY|INFINITE|FINITE|DEV$(list_benches)>]"
825 echo " [--group-diff]"
926 echo " [--graphs]"
1027 echo " [--no-measure]"
@@ -14,9 +31,9 @@ print_help () {
1431 echo " [--quick]"
1532 echo " [--compare] [--base commit] [--candidate commit]"
1633 echo " [--cabal-build-flags]"
17− echo " -- <gauge options>"
34+ echo " -- <gauge options or benchmarks>"
1835 echo
19− echo "Multiple benchmarks can be specified as a space separate list"
36+ echo "Multiple benchmarks can be specified as a space separated list"
2037 echo " e.g. --benchmarks \"linear nested\""
2138 echo
2239 echo "--group-diff is used to compare groups within a single benchmark"
@@ -39,12 +56,23 @@ die () {
3956set_benchmarks() {
4057 if test -z "$BENCHMARKS"
4158 then
42− BENCHMARKS=$DEFAULT_BENCHMARKS
43− elif test "$BENCHMARKS" = "all"
44− then
45− BENCHMARKS=$ALL_BENCHMARKS
59+ echo $DEFAULT_BENCHMARKS
60+ else
61+ for i in $(echo $BENCHMARKS)
62+ do
63+ case $i in
64+ ALL) echo -n $ALL_BENCHMARKS ;;
65+ DEV) echo -n $DEV_BENCHMARKS ;;
66+ SERIAL) echo -n $SERIAL_BENCHMARKS ;;
67+ CONCURRENT) echo -n $CONCURRENT_BENCHMARKS ;;
68+ ARRAY) echo -n $ARRAY_BENCHMARKS ;;
69+ INFINITE) echo -n $INFINITE_BENCHMARKS ;;
70+ FINITE) echo -n $FINITE_BENCHMARKS ;;
71+ *) echo -n $i ;;
72+ esac
73+ echo -n " "
74+ done
4675 fi
47− echo "Using benchmark suites [$BENCHMARKS]"
4876}
4977
5078# $1: benchmark name (linear, nested, base)
@@ -313,7 +341,12 @@ done
313341GAUGE_ARGS=$*
314342
315343echo "Using stack command [$STACK]"
316−set_benchmarks
344+BENCHMARKS=$(set_benchmarks)
345+if test "$LONG" -ne 0
346+then
347+ BENCHMARKS=$INFINITE_BENCHMARKS
348+fi
349+echo "Using benchmark suites [$BENCHMARKS]"
317350
318351# XXX we can remove these if we pass stack build flags from command line like
319352# cabal build flags.
benchmark/Chart.hs+32−4
@@ -32,7 +32,11 @@ data BenchType
3232 | Base
3333 | FileIO
3434 | Array
35+ | UnpinnedArray
36+ | SmallArray
37+ | PrimArray
3538 | Concurrent
39+ | Parallel
3640 deriving Show
3741
3842data Options = Options
@@ -76,7 +80,11 @@ parseBench = do
7680 Just "base" -> setBenchType Base
7781 Just "fileio" -> setBenchType FileIO
7882 Just "array" -> setBenchType Array
83+ Just "unpinned-array" -> setBenchType UnpinnedArray
84+ Just "small-array" -> setBenchType SmallArray
85+ Just "prim-array" -> setBenchType PrimArray
7986 Just "concurrent" -> setBenchType Concurrent
87+ Just "parallel" -> setBenchType Parallel
8088 Just str -> do
8189 liftIO $ putStrLn $ "unrecognized benchmark type " <> str
8290 mzero
@@ -247,9 +255,9 @@ makeFileIOGraphs :: Config -> String -> IO ()
247255makeFileIOGraphs cfg@Config{..} inputFile =
248256 ignoringErr $ graph inputFile "fileIO" cfg
249257
250−makeArrayGraphs :: Config -> String -> IO ()
251−makeArrayGraphs cfg@Config{..} inputFile =
252− ignoringErr $ graph inputFile "array" cfg
258+makeGraphs :: String -> Config -> String -> IO ()
259+makeGraphs name cfg@Config{..} inputFile =
260+ ignoringErr $ graph inputFile name cfg
253261
254262makeConcurrentGraphs :: Config -> String -> IO ()
255263makeConcurrentGraphs cfg@Config{..} inputFile =
@@ -370,14 +378,34 @@ main = do
370378 "charts/fileio"
371379 Array -> benchShow opts cfg
372380 { title = Just "Array" }
373− makeArrayGraphs
381+ (makeGraphs "array")
374382 "charts/array/results.csv"
375383 "charts/array"
384+ UnpinnedArray -> benchShow opts cfg
385+ { title = Just "Unpinned Array" }
386+ (makeGraphs "unpinned-array")
387+ "charts/unpinned-array/results.csv"
388+ "charts/unpinned-array"
389+ SmallArray -> benchShow opts cfg
390+ { title = Just "Small Array" }
391+ (makeGraphs "small-array")
392+ "charts/small-array/results.csv"
393+ "charts/small-array"
394+ PrimArray -> benchShow opts cfg
395+ { title = Just "Prim Array" }
396+ (makeGraphs "prim-array")
397+ "charts/prim-array/results.csv"
398+ "charts/prim-array"
376399 Concurrent -> benchShow opts cfg
377400 { title = Just "Concurrent Ops" }
378401 makeConcurrentGraphs
379402 "charts/concurrent/results.csv"
380403 "charts/concurrent"
404+ Parallel -> benchShow opts cfg
405+ { title = Just "Parallel" }
406+ (makeGraphs "parallel")
407+ "charts/parallel/results.csv"
408+ "charts/parallel"
381409 Base -> do
382410 let cfg' = cfg { title = Just "Base stream" }
383411 if groupDiff