mirror of
https://github.com/denoland/deno.git
synced 2024-11-01 09:24:20 -04:00
d5634164cb
Closes https://github.com/denoland/deno/issues/2699 Closes https://github.com/denoland/deno/issues/2347 Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not need to switch the cargo toolchain to nightly. Do we care about formatting stability of our codebase across Rust versions? (I don't)
28 lines
693 B
Rust
28 lines
693 B
Rust
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
|
|
use deno_bench_util::bench_js_sync;
|
|
use deno_bench_util::bench_or_profile;
|
|
use deno_bench_util::bencher::benchmark_group;
|
|
use deno_bench_util::bencher::Bencher;
|
|
|
|
use deno_core::Extension;
|
|
|
|
fn setup() -> Vec<Extension> {
|
|
vec![
|
|
deno_webidl::init(),
|
|
deno_url::init(),
|
|
Extension::builder("bench_setup")
|
|
.js(vec![(
|
|
"setup",
|
|
"const { URL } = globalThis.__bootstrap.url;",
|
|
)])
|
|
.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);
|