jon.recoil.org

Module Bench_configSource

Default Bench_config module, available ambiently everywhere ppx_bench is included.

The around_measurement and around_benchmark functions in this module do nothing.

include Bench_config_types.S with type benchmark_ctx = unit and type arg = unit
Sourcetype benchmark_ctx = unit

Type of the per-benchmark context, which is initialized by around_benchmark and provided to around_measurement. The value can also be bound in the scope of a let%bench or let%bench_fun using the [@ctx?] attribute, like so:

  let%bench_fun ("my benchmark" [@ctx? ctx]) =
    fun arg -> do_something_expensive ctx arg
  ;;
Sourcetype arg = unit

Argument type which is passed locally to functions on the right-hand-side of let%bench_fun. If this is anything other than unit, let%bench cannot be used.

Sourceval around_benchmark : f:(Bench_config.benchmark_ctx @ local -> 'r) @ local local -> 'r

Function which is run once around each benchmark (defined by let%bench or let%bench_fun) and can perform per-benchmark setup and teardown, and also initialize the benchmark_ctx argument to pass to the around_measurement function and (optionally) the benchmark itself.

Sourceval around_measurement : Bench_config.benchmark_ctx @ local -> f:(Bench_config.arg @ local -> 'r) @ local local -> 'r

Function which is invoked around each "batch" of benchmark runs, and provides arg to the benchmark itself to run. This function can be used to perform per-batch setup and teardown, and also provide a local context value (such as a capability) to the benchmark.