1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 02:29:06 -05:00
denoland-deno/ext/url/benches/url_ops.rs
2021-08-11 12:27:05 +02:00

27 lines
629 B
Rust

use deno_bench_util::bench_js_sync;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::{benchmark_group, Bencher};
use deno_core::Extension;
fn setup() -> Vec<Extension> {
vec![
deno_webidl::init(),
deno_url::init(),
Extension::builder()
.js(vec![(
"setup",
Box::new(|| {
Ok(r#"const { URL } = globalThis.__bootstrap.url;"#.to_owned())
}),
)])
.build(),
]
}
fn bench_url_parse(b: &mut Bencher) {
bench_js_sync(b, r#"new URL(`http://www.google.com/`);"#, setup);
}
benchmark_group!(benches, bench_url_parse,);
bench_or_profile!(benches);