package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

t is roughly equivalent to Core_bench_js.Test.t, but can also be used to obtain profiles of the benchmarks. See profile below for more details.

module Interaction : sig ... end
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 Observers involved in benchmarks are cleaned up between consecutive benchmarks.

val profile : t list -> unit

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.

OCaml

Innovation. Community. Security.