How to specify per-benchmark arguments in stack's package.yaml?

Viewed 149

I have a benchmark suite written with criterion that I invoke via stack bench.

My package.yaml contains:

benchmarks:
  criterion-benchmarks:
    dependencies:
      - criterion
      - linear
    ghc-options:
      - -O2
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N
    main: Main.hs
    source-dirs: benchmark

I invoke this with:

stack bench --ba "--output bench.html"

This runs the benchmark and generates bench.html for viewing results.

In the Stack YAML Configuration documentation it shows the use of project-wide build options, implying this:

build:
  # ...
  benchmark-opts:
    benchmark-arguments: "--output bench.html"

My question is: package.yaml supports multiple benchmarks (children of benchmarks:), however I'd like to generate a different HTML output file for each one, rather than use the project-wide specification of bench.html and have them collide.

I haven't found any documentation that shows how to specify run-time arguments for each benchmark defined in package.yaml. The hpack documentation doesn't provide any obvious options that look relevant, as Common fields, or for test or bench targets.

Is it possible?

0 Answers
Related