The benchmark harness behind the performance requirements (spec/07 §8), in the shape of
visualize's Visualize.Benchmark: run/2 measures, format/1 reports.
A scenario is a module with name/0, setup/0 (the state each move is measured from)
and measure/1 (one move of the scenario, answering its measurements:
%{reductions: %{process => count}, bytes: diff_bytes, flat: %{crossing => words}}).
run/2 runs each scenario once to settle, then five times, and reports per measurement
the median and range, with the milliseconds of work each move took beside them.
Milliseconds are reported, never asserted (macaw spec/00 §4.4): the pinned bounds
live in the tests, in reductions, bytes and words, each beside the measurement it was set
from.
The scenarios join with the steps that own them (spec/07 §1–§7). They drive the
reference grid of the suite's support (Macaw.Live.Test.Grid), compiled in the test
environment, which mix macaw_live.bench runs in; elsewhere there are none.
Summary
Callbacks
One move's measurements.
The scenario's name, as the report shows it.
The state each move is measured from.
Functions
The report mix macaw_live.bench prints: one block per scenario.
Each scenario measured (spec/07 §8): a settling run, then runs: (five) measured moves:
[%{name:, runs:, reductions:, bytes:, flat:, ms:}], each measurement summarized as
%{median:, min:, max:}.
The scenarios mix macaw_live.bench runs by default: those compiled here.
Callbacks
@callback measure(state :: term()) :: %{ optional(:reductions) => %{required(term()) => non_neg_integer()}, optional(:bytes) => non_neg_integer(), optional(:flat) => %{required(term()) => non_neg_integer()} }
One move's measurements.
@callback name() :: String.t()
The scenario's name, as the report shows it.
@callback setup() :: term()
The state each move is measured from.
Functions
The report mix macaw_live.bench prints: one block per scenario.
run(scenarios \\ [Macaw.Live.Test.Scenarios.PickMove, Macaw.Live.Test.Scenarios.DataMove, Macaw.Live.Test.Scenarios.Own, Macaw.Live.Test.Scenarios.Expert, Macaw.Live.Test.Scenarios.Keyed, Macaw.Live.Test.Scenarios.Affected, Macaw.Live.Test.Scenarios.EventCost, Macaw.Live.Test.Scenarios.Boundary, Macaw.Live.Test.Scenarios.Idle, Macaw.Live.Test.Scenarios.Encode, Macaw.Live.Test.Scenarios.ManagedSeries, Macaw.Live.Test.Scenarios.ManagedDerived], opts \\ [])
Each scenario measured (spec/07 §8): a settling run, then runs: (five) measured moves:
[%{name:, runs:, reductions:, bytes:, flat:, ms:}], each measurement summarized as
%{median:, min:, max:}.
@spec scenarios() :: [module()]
The scenarios mix macaw_live.bench runs by default: those compiled here.