package bonsai
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/bonsai.bench/Bonsai_bench/index.html
Module Bonsai_bench
Source
t
is roughly equivalent to Core_bench_js.Test.t
, but can also be used to obtain profile
s of the benchmarks. See profile
below for more details.
val create :
?clock:Ui_incr.Clock.t ->
name:string ->
component:'r Bonsai.For_open.Computation.t ->
get_inject:('r -> 'a -> unit Bonsai.For_open.Effect.t) ->
'a Interaction.t ->
t
create
produces a benchmark which performs interactions
on component
. The computation is shared between runs within the benchmark runner. Since they are run a non-deterministic amount of times, benchmarks created this way should either have an interaction which is idempotent on the state, or have similar performance when the interaction is repeated many times.
val create_with_resetter :
?clock:Ui_incr.Clock.t ->
name:string ->
component:'r Bonsai.For_open.Computation.t ->
get_inject:('r -> 'a -> unit Bonsai.For_open.Effect.t) ->
'a Interaction.t ->
t
create_with_resetter
is equivalent to calling create
, with interactions equal to Interaction.many interactions; Interaction.reset_model; Interaction.stabilize
.
val benchmark :
?run_config:Core_bench_js.Run_config.t ->
?analysis_configs:Core_bench_js.Analysis_config.t list ->
?display_config:Core_bench_js.Display_config.t ->
?save_to_file:(Core_bench_js.Measurement.t -> string) ->
?libname:string ->
t list ->
unit
benchmark
works identically to Core_bench_js.bench
, but ensures that Observer
s involved in benchmarks are cleaned up between consecutive benchmarks.
profile
runs a given t
as an instrumented computation, and provides snapshots of how much time is spent within different parts of bonsai code. It also provides statistics on incremental overhead.
Note: because profile
runs on an instrumented computation, the total running time of the test may be higher. Furthermore, because profile
only runs the computation once, timing may vary between runs. It is useful for drilling into slow benchmarks, but benchmark
should be the source of truth for timing interactions.