mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 11:37:22 +03:00
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
This commit is contained in:
parent
1e9482e6ef
commit
8fd51b2a37
@ -126,13 +126,13 @@ it basically selects all benchmarks starting with
|
|||||||
Run a specific benchmark in `Prelude.Serial` suite:
|
Run a specific benchmark in `Prelude.Serial` suite:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ bench.sh --benchmarks Prelude.Serial --prefix Prelude.Serial/o-1-space/generation/unfoldr
|
$ bench.sh --benchmarks Prelude.Serial --prefix Prelude.Serial/o-1-space.generation.unfoldr
|
||||||
```
|
```
|
||||||
|
|
||||||
Run a benchmark directly instead of running it through `bench.sh`:
|
Run a benchmark directly instead of running it through `bench.sh`:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cabal run bench:Prelude.Serial -- Prelude.Serial/o-1-space/generation/unfoldr
|
$ cabal run bench:Prelude.Serial --prefix Prelude.Serial/o-1-space.generation.unfoldr
|
||||||
```
|
```
|
||||||
|
|
||||||
The options after `--` are the benchmark executable options.
|
The options after `--` are the benchmark executable options.
|
||||||
|
23
benchmark/bench-report/bench-report.cabal
Normal file
23
benchmark/bench-report/bench-report.cabal
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
cabal-version: 2.2
|
||||||
|
name: bench-report
|
||||||
|
version: 0.0.0
|
||||||
|
synopsis: Benchmark report generation
|
||||||
|
description: Benchmark reporting application is not included in the overall
|
||||||
|
cabal project so that the dependencies of both can remain independent.
|
||||||
|
Benchmark reporting has a lot of dependencies that usually lag behind
|
||||||
|
when new GHC releases arrive.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
-- benchmark comparison and presentation
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
executable bench-report
|
||||||
|
default-language: Haskell2010
|
||||||
|
ghc-options: -Wall
|
||||||
|
hs-source-dirs: .
|
||||||
|
main-is: BenchReport.hs
|
||||||
|
buildable: True
|
||||||
|
build-Depends:
|
||||||
|
base >= 4.9 && < 5
|
||||||
|
, bench-show >= 0.3 && < 0.4
|
||||||
|
, transformers >= 0.4 && < 0.6
|
1
benchmark/bench-report/cabal.project
Normal file
1
benchmark/bench-report/cabal.project
Normal file
@ -0,0 +1 @@
|
|||||||
|
packages: benchmark/bench-report/bench-report.cabal
|
30
benchmark/bench-report/default.nix
Normal file
30
benchmark/bench-report/default.nix
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (nixpkgs) pkgs;
|
||||||
|
|
||||||
|
f = { mkDerivation, base, bench-show, stdenv, transformers }:
|
||||||
|
mkDerivation {
|
||||||
|
pname = "bench-report";
|
||||||
|
version = "0.0.0";
|
||||||
|
src = ./.;
|
||||||
|
isLibrary = false;
|
||||||
|
isExecutable = true;
|
||||||
|
executableHaskellDepends = [ base bench-show transformers ];
|
||||||
|
description = "Benchmark report generation";
|
||||||
|
license = "unknown";
|
||||||
|
hydraPlatforms = stdenv.lib.platforms.none;
|
||||||
|
};
|
||||||
|
|
||||||
|
haskellPackages = if compiler == "default"
|
||||||
|
then pkgs.haskellPackages
|
||||||
|
else pkgs.haskell.packages.${compiler};
|
||||||
|
|
||||||
|
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
|
||||||
|
|
||||||
|
drv = variant (haskellPackages.callPackage f {});
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
if pkgs.lib.inNixShell then drv.env else drv
|
@ -44,11 +44,6 @@ flag has-llvm
|
|||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
flag no-charts
|
|
||||||
description: Disable benchmark charts in development build
|
|
||||||
manual: True
|
|
||||||
default: False
|
|
||||||
|
|
||||||
flag opt
|
flag opt
|
||||||
description: off=-O0 (faster builds), on=-O2
|
description: off=-O0 (faster builds), on=-O2
|
||||||
manual: True
|
manual: True
|
||||||
@ -507,21 +502,3 @@ benchmark Unicode.Stream
|
|||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
hs-source-dirs: Streamly/Benchmark/Unicode
|
hs-source-dirs: Streamly/Benchmark/Unicode
|
||||||
main-is: Stream.hs
|
main-is: Stream.hs
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
-- benchmark comparison and presentation
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
executable chart
|
|
||||||
default-language: Haskell2010
|
|
||||||
ghc-options: -Wall
|
|
||||||
hs-source-dirs: .
|
|
||||||
main-is: Chart.hs
|
|
||||||
if flag(dev) && !flag(no-charts) && !impl(ghcjs)
|
|
||||||
buildable: True
|
|
||||||
build-Depends:
|
|
||||||
base >= 4.9 && < 5
|
|
||||||
, bench-show >= 0.3 && < 0.4
|
|
||||||
, transformers >= 0.4 && < 0.6
|
|
||||||
else
|
|
||||||
buildable: False
|
|
||||||
|
18
bin/bench.sh
18
bin/bench.sh
@ -71,11 +71,11 @@ list_comparisons () {
|
|||||||
# chart is expensive to build and usually not required to be rebuilt,
|
# chart is expensive to build and usually not required to be rebuilt,
|
||||||
# use master branch as fallback
|
# use master branch as fallback
|
||||||
cabal_which_report() {
|
cabal_which_report() {
|
||||||
local path=$(cabal_which streamly-benchmarks x $1)
|
local path=$(cabal_which bench-report x $1)
|
||||||
if test -z "$path"
|
if test -z "$path"
|
||||||
then
|
then
|
||||||
echo "Cannot find $1 executable, trying in dist-newstyle" 1>&2
|
echo "Cannot find $1 executable, trying in dist-newstyle" 1>&2
|
||||||
local path1=$(cabal_which_builddir dist-newstyle streamly-benchmarks x $1)
|
local path1=$(cabal_which_builddir dist-newstyle bench-report x $1)
|
||||||
if test -z "$path1"
|
if test -z "$path1"
|
||||||
then
|
then
|
||||||
local path2="./bin/$1"
|
local path2="./bin/$1"
|
||||||
@ -93,7 +93,7 @@ cabal_which_report() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
find_report_prog() {
|
find_report_prog() {
|
||||||
local prog_name="chart"
|
local prog_name="bench-report"
|
||||||
hash -r
|
hash -r
|
||||||
local prog_path=$(cabal_which_report $prog_name)
|
local prog_path=$(cabal_which_report $prog_name)
|
||||||
if test -x "$prog_path"
|
if test -x "$prog_path"
|
||||||
@ -105,16 +105,16 @@ find_report_prog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_report_prog() {
|
build_report_prog() {
|
||||||
local prog_name="chart"
|
local prog_name="bench-report"
|
||||||
local prog_path=$(cabal_which_report $prog_name)
|
local prog_path=$(cabal_which_report $prog_name)
|
||||||
|
|
||||||
hash -r
|
hash -r
|
||||||
if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
|
if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
|
||||||
then
|
then
|
||||||
echo "Building bench-show executables"
|
echo "Building bench-report executables"
|
||||||
BUILD_ONCE=1
|
BUILD_ONCE=1
|
||||||
$CABAL_EXECUTABLE v2-build --flags dev chart \
|
$CABAL_EXECUTABLE v2-build bench-report --project-file=benchmark/bench-report/cabal.project \
|
||||||
|| die "bench-show build failed"
|
|| die "bench-report build failed"
|
||||||
|
|
||||||
elif test ! -x "$prog_path"
|
elif test ! -x "$prog_path"
|
||||||
then
|
then
|
||||||
@ -129,8 +129,8 @@ build_report_progs() {
|
|||||||
build_report_prog || exit 1
|
build_report_prog || exit 1
|
||||||
local prog
|
local prog
|
||||||
prog=$(find_report_prog) || \
|
prog=$(find_report_prog) || \
|
||||||
die "Cannot find bench-show executable"
|
die "Cannot find bench-report executable"
|
||||||
echo "Using bench-show executable [$prog]"
|
echo "Using bench-report executable [$prog]"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,10 @@ extra-source-files:
|
|||||||
appveyor.yml
|
appveyor.yml
|
||||||
benchmark/*.hs
|
benchmark/*.hs
|
||||||
benchmark/README.md
|
benchmark/README.md
|
||||||
|
benchmark/bench-report/BenchReport.hs
|
||||||
|
benchmark/bench-report/bench-report.cabal
|
||||||
|
benchmark/bench-report/cabal.project
|
||||||
|
benchmark/bench-report/default.nix
|
||||||
benchmark/Streamly/Benchmark/Data/*.hs
|
benchmark/Streamly/Benchmark/Data/*.hs
|
||||||
benchmark/Streamly/Benchmark/Data/Array/Stream/Foreign.hs
|
benchmark/Streamly/Benchmark/Data/Array/Stream/Foreign.hs
|
||||||
benchmark/Streamly/Benchmark/Data/Parser/*.hs
|
benchmark/Streamly/Benchmark/Data/Parser/*.hs
|
||||||
|
Loading…
Reference in New Issue
Block a user