GitXplorerGitXplorer
j

bonsai_bench

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
293c9743d03440b5b21a26089714d6ed20026d4e

v0.18~preview.130.05+548

ppublic-release committed 2 months ago
Unverified
2f0e34418a766ddfa18b2ab1b0deb1b221210a97

v0.18~preview.130.00+55

ppublic-release committed 3 months ago
Unverified
4f275cdd60dcff143d04874fdb103dc4d4b055be

v0.18~preview.129.42+498

ppublic-release committed 4 months ago
Unverified
990b2314766df312fd1b2e685401b1bc3d3ef7d3

v0.17~preview.129.36+325

ppublic-release committed 5 months ago
Verified
91a8d5732613660a7c9b13d1e4bbe8be040f9fba

Initial commit

ppublic-release committed 5 months ago

README

The README file for this repository.

Benchmarking Bonsai Components

Bonsai_bench is a library which provides facilities for benchmarking Bonsai components.

Creating a benchmark

Bonsai_bench.Test.create creates a benchmark. It takes a component to benchmark, a way to extract that component's inject_action function, and a list of interactions to perform during the benchmark. For example:

let state =
  Bonsai_bench.Test.create
    ~name:"Bonsai.state"
    ~component:(Bonsai.state [%here] (module Int) ~default_model:0)
    ~get_inject:(fun (_, inject) -> inject)
    Bonsai_bench.Interaction.(many_with_stabilizations [ inject 1; reset_model ])

There are more examples in the example/ directory.

Running a benchmark

To run the benchmark, pass it to Bonsai_bench.bench, a thin wrapper around Core_bench_js.bench that handles necessary cleanup between tests:

let () =
  let quota = Core_bench_js.Quota.Span (Time.Span.of_sec 1.0) in
  Bonsai_bench.bench ~run_config:(Core_bench_js.Run_config.create () ~quota) [ state ]

Build the javascript-executables target for the directory with BUILD_PROFILE=fast-exe. Then, from a terminal, run: node path/to/executable/name.bc.js to see the results.

Code organization

  • src/bonsai_bench.mli: Contains the API for running and creating tests. The list of possible interactions that can be performed during benchmarks can also be found there.