Liking cljdoc? Tell your friends :D

criterium.benchmark

Namespace for composing and executing benchmarks from declarative specs. Provides functionality to construct benchmark functions from analysis and view configurations.

Namespace for composing and executing benchmarks from declarative specs.
Provides functionality to construct benchmark functions from analysis and
view configurations.
raw docstring

*time-analyse*clj

When true, print elapsed time for each analysis function.

When true, print elapsed time for each analysis function.
sourceraw docstring

->analyseclj

(->analyse analyse-plan)

Creates a composite analysis function from a sequence of analysis specs.

Each spec is either a keyword/symbol to resolve a function, or a vector with a keyword/symbol first element followed by arguments.

Analysis functions:

  • Are composed in sequence from last to first
  • Each takes a sampled map as input
  • Each returns a modified sampled map

Example specs: [:stats [:quantiles {:quantiles [0.025 0.975]}]]

Returns a function that takes sampled data and returns analysis results.

Creates a composite analysis function from a sequence of analysis specs.

Each spec is either a keyword/symbol to resolve a function, or a vector
with a keyword/symbol first element followed by arguments.

Analysis functions:
- Are composed in sequence from last to first
- Each takes a sampled map as input
- Each returns a modified sampled map

Example specs: [:stats
                [:quantiles {:quantiles [0.025 0.975]}]]

Returns a function that takes sampled data and returns analysis results.
sourceraw docstring

->benchmarkclj

(->benchmark bench-plan)

Compose a benchmark based on a declarative map.

The :analyse and :view keywords take a vector of function specs. A function spec is either a keyword/symbol to resolve a function, or a vector with a keyword/symbol first element followed by arguments.

Analysis functions:

  • Are composed in sequence from last to first
  • Each takes a sampled map as input
  • Each returns a modified sampled map

View functions:

  • Are called in order with the final analysis result
  • Are expected to produce side effects (printing, plotting etc.)
  • Return values are ignored

Example spec: {:analyse [:stats [:quantiles {:quantiles [0.025 0.975]}]] :view [:text-table]}

Returns a function that takes a sampled map and returns analysis results.

Compose a benchmark based on a declarative map.

The :analyse and :view keywords take a vector of function specs. A
function spec is either a keyword/symbol to resolve a function, or a
vector with a keyword/symbol first element followed by arguments.

Analysis functions:
- Are composed in sequence from last to first
- Each takes a sampled map as input
- Each returns a modified sampled map

View functions:
- Are called in order with the final analysis result
- Are expected to produce side effects (printing, plotting etc.)
- Return values are ignored

Example spec:
{:analyse [:stats [:quantiles {:quantiles [0.025 0.975]}]]
 :view [:text-table]}

Returns a function that takes a sampled map and returns analysis results.
sourceraw docstring

->viewclj

(->view view-plan)

Creates a composite view function from a sequence of view specs.

Each spec is either a keyword/symbol to resolve a function, or a vector with a keyword/symbol first element followed by arguments.

View functions:

  • Are called in order with the analysis result
  • Are expected to produce side effects (printing, plotting etc.)
  • Return values are ignored

Example specs: [:text-table]

Returns a function that takes analysis results and handles viewing.

Creates a composite view function from a sequence of view specs.

Each spec is either a keyword/symbol to resolve a function, or a vector
with a keyword/symbol first element followed by arguments.

View functions:
- Are called in order with the analysis result
- Are expected to produce side effects (printing, plotting etc.)
- Return values are ignored

Example specs: [:text-table]

Returns a function that takes analysis results and handles viewing.
sourceraw docstring

wrap-with-timingclj

(wrap-with-timing spec f)

Wrap an analysis function with timing instrumentation. When time-analyse is truthy, prints the spec and elapsed time to out. Returns a function that takes data-map and returns the analysis result.

Wrap an analysis function with timing instrumentation.
When *time-analyse* is truthy, prints the spec and elapsed time to *out*.
Returns a function that takes data-map and returns the analysis result.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close