gleamy/bench

Types

pub type BenchResults {
  BenchResults(options: Options, sets: List(Set))
}

Constructors

  • BenchResults(options: Options, sets: List(Set))
pub type Function(a, b) {
  Function(label: String, function: fn(a) -> b)
  SetupFunction(
    label: String,
    setup_function: fn(a) -> fn(a) -> b,
  )
}

Constructors

  • Function(label: String, function: fn(a) -> b)
  • SetupFunction(label: String, setup_function: fn(a) -> fn(a) -> b)
pub type Input(a) {
  Input(label: String, value: a)
}

Constructors

  • Input(label: String, value: a)
pub type Option {
  Warmup(ms: Int)
  Duration(ms: Int)
  Decimals(n: Int)
  Quiet
}

Constructors

  • Warmup(ms: Int)
  • Duration(ms: Int)
  • Decimals(n: Int)
  • Quiet
pub type Options {
  Options(warmup: Int, duration: Int, decimals: Int, quiet: Bool)
}

Constructors

  • Options(warmup: Int, duration: Int, decimals: Int, quiet: Bool)
pub type Set {
  Set(input: String, function: String, reps: List(Float))
}

Constructors

  • Set(input: String, function: String, reps: List(Float))
pub type Stat {
  P(Int)
  IPS
  Min
  Max
  Mean
  SD
  SDPercent
  Stat(name: String, calculate: fn(Set) -> Float)
}

Constructors

  • P(Int)
  • IPS
  • Min
  • Max
  • Mean
  • SD
  • SDPercent
  • Stat(name: String, calculate: fn(Set) -> Float)

Functions

pub fn do_repeat(n: Int, input: a, fun: fn(a) -> b) -> Nil
pub fn now() -> Float

timestamp in milliseconds

pub fn repeat(n: Int, fun: fn(a) -> b) -> fn(a) -> Nil
pub fn run(
  inputs: List(Input(a)),
  functions: List(Function(a, b)),
  options: List(Option),
) -> BenchResults
pub fn table(result: BenchResults, stats: List(Stat)) -> String
Search Document