diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2021-08-11 12:27:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-11 12:27:05 +0200 |
| commit | a0285e2eb88f6254f6494b0ecd1878db3a3b2a58 (patch) | |
| tree | 90671b004537e20f9493fd3277ffd21d30b39a0e /ext/url/benches | |
| parent | 3a6994115176781b3a93d70794b1b81bc95e42b4 (diff) | |
Rename extensions/ directory to ext/ (#11643)
Diffstat (limited to 'ext/url/benches')
| -rw-r--r-- | ext/url/benches/url_ops.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/url/benches/url_ops.rs b/ext/url/benches/url_ops.rs new file mode 100644 index 000000000..ed27b6f80 --- /dev/null +++ b/ext/url/benches/url_ops.rs @@ -0,0 +1,27 @@ +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); |
