Skip to content

deno bench ignores n and warmupoptions when code being benched is too quick #28430

Closed
@albnnc

Description

@albnnc

Version: Deno 2.2.3

According to this PR, n and warmup options should work again.

However, if I have the following bench code:

let i = 0;

Deno.bench(
  "noop",
  { n: 3, warmup: 1 },
  () => {
    ++i;
    console.log(i);
  },
);

I get unexpected output:

...
test: 67854
test: 67855
test: 67856
test: 67857
test: 67858
test: 67859
test: 67860
test: 67861
test                 7.5 µs       133,900 (  3.2 µs …   4.4 ms)   5.6 µs  44.6 µs  51.2 µs

Do I understand n and warmup options wrong?

Also, in case of missing warmup option and presence of n, should Deno actually warmup benchmark in some "intellectual" way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questiona question about the use of Deno

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions