mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(bench): run warmup benchmark to break JIT bias (#19844)
Closes https://github.com/denoland/deno/issues/15277 This commit adds a single "warmup" run of empty function when running `deno bench`. This change will break so-called "JIT bias" which makes V8 optimize the first function and then bail out of optimization on second function. In essence the "warmup" function is getting optimized and then all user benches are bailed out of optimization.
This commit is contained in:
parent
4ebe3bdb06
commit
298e414936
3 changed files with 34 additions and 0 deletions
|
@ -101,6 +101,8 @@ struct BenchInfo<'s> {
|
|||
group: Option<String>,
|
||||
ignore: bool,
|
||||
only: bool,
|
||||
#[serde(default)]
|
||||
warmup: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
@ -128,6 +130,7 @@ fn op_register_bench<'a>(
|
|||
group: info.group,
|
||||
ignore: info.ignore,
|
||||
only: info.only,
|
||||
warmup: info.warmup,
|
||||
};
|
||||
let function: v8::Local<v8::Function> = info.function.v8_value.try_into()?;
|
||||
let function = v8::Global::new(scope, function);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue