View Source BencheeDsl.Benchmark behaviour (BencheeDsl v0.1.4)

Helpers for defining a benchmark with the DSL.

This module must be used to define and configure a benchmark.

Link to this section Summary

Callbacks

Runs the benchmark.

Runs the benchmark with the given config.

Functions

Configures the benchmark.

Adds a formatter to the benchmark.

Defines a function or map to setup the inputs for the benchmark. If inputs has a do block a map is expected to be returned.

This macro defines a function for the benchmark.

Overwrites the job map. This function can be used to set up jobs dynamically.

Updates the job map. This function can be used to set up jobs dynamically.

Creates a new Benchmark struct.

Defines a callback that runs once the benchmark exits.

Defines a setup callback to be run before the benchmark starts.

Updates a benchmark struct by the given key or path.

Link to this section Types

@type keys() :: :config | :description | :dir | :module | :title
@type t() :: %BencheeDsl.Benchmark{
  config: keyword(),
  description: String.t(),
  dir: String.t(),
  module: module(),
  title: String.t()
}

Link to this section Callbacks

@callback run() :: :ok

Runs the benchmark.

@callback run(config :: keyword()) :: :ok

Runs the benchmark with the given config.

Link to this section Functions

Link to this macro

config(config)

View Source (macro)

Configures the benchmark.

Link to this macro

formatter(module, opts)

View Source (macro)

Adds a formatter to the benchmark.

Link to this macro

inputs(inputs)

View Source (macro)

Defines a function or map to setup the inputs for the benchmark. If inputs has a do block a map is expected to be returned.

This macro defines a function for the benchmark.

Link to this macro

job(fun, list)

View Source (macro)
Link to this macro

job(fun_name, var, list)

View Source (macro)

Overwrites the job map. This function can be used to set up jobs dynamically.

Link to this macro

jobs(var, list)

View Source (macro)

Updates the job map. This function can be used to set up jobs dynamically.

@spec new(keyword()) :: t()

Creates a new Benchmark struct.

Defines a callback that runs once the benchmark exits.

Defines a setup callback to be run before the benchmark starts.

Link to this function

update(benchmark, key, fun)

View Source
@spec update(t(), keys() | [atom()], (any() -> any())) :: t()

Updates a benchmark struct by the given key or path.