Skip to content

Default parameter option evals_set is not documented #374

@pjaap

Description

@pjaap

Hi there,

maybe I miss something completely, but I do not understand the meaning of samples and evals for the benchmarks.

If I run this code in REPL

using BenchmarkTools
BenchmarkTools.DEFAULT_PARAMETERS.samples = 1
BenchmarkTools.DEFAULT_PARAMETERS.evals = 1

foo_calls = 0

function foo()
  global foo_calls += 1
end

b = @benchmark foo()

@show foo_calls

b

it should, as I understood the documentation, evaluate foo once. However, it produces

foo_calls = 501494
BenchmarkTools.Trial: 1 sample with 993 evaluations.
 Single result which took 37.263 ns (0.00% GC) to evaluate,
 with a memory estimate of 16 bytes, over 1 allocations.

Why does it evaluate foo 993 times while it was called in reality 501494 times?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions