mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00

Some checks are pending
ci / publish canary (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
47 lines
1.1 KiB
Rust
47 lines
1.1 KiB
Rust
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
use deno_bench_util::bench_js_async;
|
|
use deno_bench_util::bench_or_profile;
|
|
use deno_bench_util::bencher::Bencher;
|
|
use deno_bench_util::bencher::benchmark_group;
|
|
use deno_core::Extension;
|
|
|
|
#[derive(Clone)]
|
|
struct Permissions;
|
|
|
|
impl deno_web::TimersPermission for Permissions {
|
|
fn allow_hrtime(&mut self) -> bool {
|
|
true
|
|
}
|
|
}
|
|
|
|
fn setup() -> Vec<Extension> {
|
|
deno_core::extension!(
|
|
bench_setup,
|
|
esm_entry_point = "ext:bench_setup/setup",
|
|
esm = ["ext:bench_setup/setup" = {
|
|
source = r#"
|
|
import { setTimeout } from "ext:deno_web/02_timers.js";
|
|
globalThis.setTimeout = setTimeout;
|
|
"#
|
|
}],
|
|
state = |state| {
|
|
state.put(Permissions {});
|
|
},
|
|
);
|
|
|
|
vec![
|
|
deno_webidl::deno_webidl::init(),
|
|
deno_url::deno_url::init(),
|
|
deno_console::deno_console::init(),
|
|
deno_web::deno_web::init::<Permissions>(Default::default(), None),
|
|
bench_setup::init(),
|
|
]
|
|
}
|
|
|
|
fn bench_set_timeout(b: &mut Bencher) {
|
|
bench_js_async(b, r#"setTimeout(() => {}, 0);"#, setup);
|
|
}
|
|
|
|
benchmark_group!(benches, bench_set_timeout,);
|
|
bench_or_profile!(benches);
|