-
Notifications
You must be signed in to change notification settings - Fork 5.6k
deno bench
ignores n
and warmup
options when code being benched is too quick
#28430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's because what's being measured is too quick so it couldn't meaningfully give you a more accurate measurement without running it a lot more times. I think it runs it for at least 10ms. |
deno bench
ignores n
and warmup
optionsdeno bench
ignores n
and warmup
options when code being benched is too quick
I tend to disagree. I wanted to start using these options because my real benchmarks run for too long: single iteration takes up to several seconds while Deno repeats bench for too many times. That being said, code above if for demonstration purposes only and I used it since it doesn't differ from actual benchmarks in any way related to Deno behaviour. |
What are you disagreeing about? |
I just relooked at the code and it runs the bench for a minimum of 500ms: Line 478 in 0ef3f6b
Maybe that could be reduced for when |
Here's my real case. Benchmark codelet i = 0;
Deno.bench(
"entity delete unit (by filter, 10000)",
{ n: 3, warmup: 0 },
async (b) => {
++i;
console.log("i =", i);
await bench(b, 10_000);
},
); Benchmark output
So, benchmark has been ran for 25 times while single run took ~1 second. I can't understand why is it like that, since each run is not "too fast" and I specified |
Ah, right now it's ignoring a warmup of Line 254 in 0ef3f6b
|
I updated the docs and it should execute much faster now. Also, specifying a
|
Version: Deno 2.2.3
According to this PR,
n
andwarmup
options should work again.However, if I have the following bench code:
I get unexpected output:
Do I understand
n
andwarmup
options wrong?Also, in case of missing
warmup
option and presence ofn
, should Deno actually warmup benchmark in some "intellectual" way?The text was updated successfully, but these errors were encountered: