on master help sign in
Seperate chart build from benchmarks

Add extra-source-files to streamly.cabal Fix review comments Rename Chart.hs to BenchReport.hs Fix extra-source-files Remove no-charts flag

commit8fd51b2a37114243ef1950ddbf0974248518cd49 authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateFri 11 Jun 2021, 16:03 (5 years ago) parent1e9482e
8 files changed+69−34
benchmark/README.md+2−2 benchmark/Chart.hs → benchmark/bench-report/BenchReport.hs benchmark/bench-report/bench-report.cabal+23 benchmark/bench-report/cabal.project+1 benchmark/bench-report/default.nix+30 benchmark/streamly-benchmarks.cabal−23 bin/bench.sh+9−9 streamly.cabal+4
benchmark/README.md+2−2
@@ -126,13 +126,13 @@ it basically selects all benchmarks starting with
126126Run a specific benchmark in `Prelude.Serial` suite:
127127
128128```
129−$ bench.sh --benchmarks Prelude.Serial --prefix Prelude.Serial/o-1-space/generation/unfoldr
129+$ bench.sh --benchmarks Prelude.Serial --prefix Prelude.Serial/o-1-space.generation.unfoldr
130130```
131131
132132Run a benchmark directly instead of running it through `bench.sh`:
133133
134134```
135−$ cabal run bench:Prelude.Serial -- Prelude.Serial/o-1-space/generation/unfoldr
135+$ cabal run bench:Prelude.Serial --prefix Prelude.Serial/o-1-space.generation.unfoldr
136136```
137137
138138The options after `--` are the benchmark executable options.
benchmark/Chart.hs → benchmark/bench-report/BenchReport.hsrenamed

The content is the same.

benchmark/bench-report/bench-report.cabalnew file+23
@@ -0,0 +1,23 @@
1+cabal-version: 2.2
2+name: bench-report
3+version: 0.0.0
4+synopsis: Benchmark report generation
5+description: Benchmark reporting application is not included in the overall
6+ cabal project so that the dependencies of both can remain independent.
7+ Benchmark reporting has a lot of dependencies that usually lag behind
8+ when new GHC releases arrive.
9+
10+-------------------------------------------------------------------------------
11+-- benchmark comparison and presentation
12+-------------------------------------------------------------------------------
13+
14+executable bench-report
15+ default-language: Haskell2010
16+ ghc-options: -Wall
17+ hs-source-dirs: .
18+ main-is: BenchReport.hs
19+ buildable: True
20+ build-Depends:
21+ base >= 4.9 && < 5
22+ , bench-show >= 0.3 && < 0.4
23+ , transformers >= 0.4 && < 0.6
benchmark/bench-report/cabal.projectnew file+1
@@ -0,0 +1 @@
1+packages: benchmark/bench-report/bench-report.cabal
benchmark/bench-report/default.nixnew file+30
@@ -0,0 +1,30 @@
1+{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
2+
3+let
4+
5+ inherit (nixpkgs) pkgs;
6+
7+ f = { mkDerivation, base, bench-show, stdenv, transformers }:
8+ mkDerivation {
9+ pname = "bench-report";
10+ version = "0.0.0";
11+ src = ./.;
12+ isLibrary = false;
13+ isExecutable = true;
14+ executableHaskellDepends = [ base bench-show transformers ];
15+ description = "Benchmark report generation";
16+ license = "unknown";
17+ hydraPlatforms = stdenv.lib.platforms.none;
18+ };
19+
20+ haskellPackages = if compiler == "default"
21+ then pkgs.haskellPackages
22+ else pkgs.haskell.packages.${compiler};
23+
24+ variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
25+
26+ drv = variant (haskellPackages.callPackage f {});
27+
28+in
29+
30+ if pkgs.lib.inNixShell then drv.env else drv
benchmark/streamly-benchmarks.cabal−23
@@ -44,11 +44,6 @@ flag has-llvm
4444 manual: True
4545 default: False
4646
47−flag no-charts
48− description: Disable benchmark charts in development build
49− manual: True
50− default: False
51−
5247flag opt
5348 description: off=-O0 (faster builds), on=-O2
5449 manual: True
@@ -507,21 +502,3 @@ benchmark Unicode.Stream
507502 type: exitcode-stdio-1.0
508503 hs-source-dirs: Streamly/Benchmark/Unicode
509504 main-is: Stream.hs
510−
511−-------------------------------------------------------------------------------
512−-- benchmark comparison and presentation
513−-------------------------------------------------------------------------------
514−
515−executable chart
516− default-language: Haskell2010
517− ghc-options: -Wall
518− hs-source-dirs: .
519− main-is: Chart.hs
520− if flag(dev) && !flag(no-charts) && !impl(ghcjs)
521− buildable: True
522− build-Depends:
523− base >= 4.9 && < 5
524− , bench-show >= 0.3 && < 0.4
525− , transformers >= 0.4 && < 0.6
526− else
527− buildable: False
bin/bench.sh+9−9
@@ -71,11 +71,11 @@ list_comparisons () {
7171# chart is expensive to build and usually not required to be rebuilt,
7272# use master branch as fallback
7373cabal_which_report() {
74− local path=$(cabal_which streamly-benchmarks x $1)
74+ local path=$(cabal_which bench-report x $1)
7575 if test -z "$path"
7676 then
7777 echo "Cannot find $1 executable, trying in dist-newstyle" 1>&2
78− local path1=$(cabal_which_builddir dist-newstyle streamly-benchmarks x $1)
78+ local path1=$(cabal_which_builddir dist-newstyle bench-report x $1)
7979 if test -z "$path1"
8080 then
8181 local path2="./bin/$1"
@@ -93,7 +93,7 @@ cabal_which_report() {
9393}
9494
9595find_report_prog() {
96− local prog_name="chart"
96+ local prog_name="bench-report"
9797 hash -r
9898 local prog_path=$(cabal_which_report $prog_name)
9999 if test -x "$prog_path"
@@ -105,16 +105,16 @@ find_report_prog() {
105105}
106106
107107build_report_prog() {
108− local prog_name="chart"
108+ local prog_name="bench-report"
109109 local prog_path=$(cabal_which_report $prog_name)
110110
111111 hash -r
112112 if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
113113 then
114− echo "Building bench-show executables"
114+ echo "Building bench-report executables"
115115 BUILD_ONCE=1
116− $CABAL_EXECUTABLE v2-build --flags dev chart \
117− || die "bench-show build failed"
116+ $CABAL_EXECUTABLE v2-build bench-report --project-file=benchmark/bench-report/cabal.project \
117+ || die "bench-report build failed"
118118
119119 elif test ! -x "$prog_path"
120120 then
@@ -129,8 +129,8 @@ build_report_progs() {
129129 build_report_prog || exit 1
130130 local prog
131131 prog=$(find_report_prog) || \
132− die "Cannot find bench-show executable"
133− echo "Using bench-show executable [$prog]"
132+ die "Cannot find bench-report executable"
133+ echo "Using bench-report executable [$prog]"
134134 fi
135135}
136136
streamly.cabal+4
@@ -60,6 +60,10 @@ extra-source-files:
6060 appveyor.yml
6161 benchmark/*.hs
6262 benchmark/README.md
63+ benchmark/bench-report/BenchReport.hs
64+ benchmark/bench-report/bench-report.cabal
65+ benchmark/bench-report/cabal.project
66+ benchmark/bench-report/default.nix
6367 benchmark/Streamly/Benchmark/Data/*.hs
6468 benchmark/Streamly/Benchmark/Data/Array/Stream/Foreign.hs
6569 benchmark/Streamly/Benchmark/Data/Parser/*.hs