2021-05-19 13:41:23 -04:00
|
|
|
use deno_bench_util::bench_js_sync;
|
|
|
|
use deno_bench_util::bench_or_profile;
|
|
|
|
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
2021-04-20 18:15:39 -04:00
|
|
|
|
2021-05-21 09:46:26 -04:00
|
|
|
use deno_core::Extension;
|
2021-04-19 09:42:59 -04:00
|
|
|
|
2021-05-21 09:46:26 -04:00
|
|
|
fn setup() -> Vec<Extension> {
|
|
|
|
vec![
|
2021-06-16 12:40:35 -04:00
|
|
|
deno_webidl::init(),
|
2021-05-21 09:46:26 -04:00
|
|
|
deno_url::init(),
|
2023-01-08 17:48:46 -05:00
|
|
|
Extension::builder("bench_setup")
|
2021-05-21 09:46:26 -04:00
|
|
|
.js(vec![(
|
|
|
|
"setup",
|
2022-05-15 07:27:56 -04:00
|
|
|
"const { URL } = globalThis.__bootstrap.url;",
|
2021-05-21 09:46:26 -04:00
|
|
|
)])
|
|
|
|
.build(),
|
|
|
|
]
|
2021-04-19 09:42:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fn bench_url_parse(b: &mut Bencher) {
|
2021-05-19 13:41:23 -04:00
|
|
|
bench_js_sync(b, r#"new URL(`http://www.google.com/`);"#, setup);
|
2021-04-19 09:42:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
benchmark_group!(benches, bench_url_parse,);
|
2021-05-19 13:41:23 -04:00
|
|
|
bench_or_profile!(benches);
|