2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-01-13 15:51:32 +08:00
|
|
|
|
2021-05-19 19:41:23 +02:00
|
|
|
use deno_bench_util::bench_js_sync;
|
|
|
|
use deno_bench_util::bench_or_profile;
|
2023-01-14 20:18:58 -08:00
|
|
|
use deno_bench_util::bencher::benchmark_group;
|
|
|
|
use deno_bench_util::bencher::Bencher;
|
2021-04-21 00:15:39 +02:00
|
|
|
|
2021-05-21 15:46:26 +02:00
|
|
|
use deno_core::Extension;
|
2021-04-19 15:42:59 +02:00
|
|
|
|
2021-05-21 15:46:26 +02:00
|
|
|
fn setup() -> Vec<Extension> {
|
2024-02-04 17:03:14 -07:00
|
|
|
deno_core::extension!(
|
|
|
|
bench_setup,
|
|
|
|
esm_entry_point = "ext:bench_setup/setup",
|
|
|
|
esm = ["ext:bench_setup/setup" = {
|
|
|
|
source = r#"
|
|
|
|
import { URL } from "ext:deno_url/00_url.js";
|
|
|
|
globalThis.URL = URL;
|
|
|
|
"#
|
|
|
|
}]
|
|
|
|
);
|
|
|
|
|
2021-05-21 15:46:26 +02:00
|
|
|
vec![
|
2023-06-26 13:54:10 +02:00
|
|
|
deno_webidl::deno_webidl::init_ops_and_esm(),
|
2023-11-20 22:01:30 +09:00
|
|
|
deno_console::deno_console::init_ops_and_esm(),
|
2023-06-26 13:54:10 +02:00
|
|
|
deno_url::deno_url::init_ops_and_esm(),
|
2024-02-04 17:03:14 -07:00
|
|
|
bench_setup::init_ops_and_esm(),
|
2021-05-21 15:46:26 +02:00
|
|
|
]
|
2021-04-19 15:42:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn bench_url_parse(b: &mut Bencher) {
|
2021-05-19 19:41:23 +02:00
|
|
|
bench_js_sync(b, r#"new URL(`http://www.google.com/`);"#, setup);
|
2021-04-19 15:42:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
benchmark_group!(benches, bench_url_parse,);
|
2021-05-19 19:41:23 +02:00
|
|
|
bench_or_profile!(benches);
|