0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
denoland-deno/extensions/url/benches/url_ops.rs
Luca Casonato 10e50a1207
core: don't include_str extension js code (#10786)
This speeds up incremental rebuild when only touching JS files by 13-15%

Rebuild time after `touch 01_broadcast_channel.js`:

main: run 1 49.18s, run 2 50.34s
this: run 1 43.12s, run 2 43.19s
2021-05-29 16:20:52 +02:00

26 lines
604 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_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);