summaryrefslogtreecommitdiff
path: root/ext/url/benches
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2021-08-11 12:27:05 +0200
committerGitHub <noreply@github.com>2021-08-11 12:27:05 +0200
commita0285e2eb88f6254f6494b0ecd1878db3a3b2a58 (patch)
tree90671b004537e20f9493fd3277ffd21d30b39a0e /ext/url/benches
parent3a6994115176781b3a93d70794b1b81bc95e42b4 (diff)
Rename extensions/ directory to ext/ (#11643)
Diffstat (limited to 'ext/url/benches')
-rw-r--r--ext/url/benches/url_ops.rs27
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);