summaryrefslogtreecommitdiff
path: root/cli/bench
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-08-21 17:37:53 +0530
committerGitHub <noreply@github.com>2022-08-21 17:37:53 +0530
commit906aa78af33c8405a47d5446d2a6fb3348c275bb (patch)
treec444e42b6bdfe4bad35634925829a1b1d190fa75 /cli/bench
parente39d4e3e7fb9815bf094e7321d1d73d00275831a (diff)
feat(ops): V8 Fast Calls (#15291)
Diffstat (limited to 'cli/bench')
-rw-r--r--cli/bench/deno_common.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js
index 074346d28..d9879194f 100644
--- a/cli/bench/deno_common.js
+++ b/cli/bench/deno_common.js
@@ -5,12 +5,31 @@ Deno.bench("date_now", { n: 5e5 }, () => {
Date.now();
});
+// Fast API calls
+{
+ // deno-lint-ignore camelcase
+ const { op_add } = Deno.core.ops;
+ // deno-lint-ignore no-inner-declarations
+ function add(a, b) {
+ return op_add.fast(a, b);
+ }
+ // deno-lint-ignore no-inner-declarations
+ function addJS(a, b) {
+ return a + b;
+ }
+ Deno.bench("op_add", () => add(1, 2));
+ Deno.bench("add_js", () => addJS(1, 2));
+}
+
+// deno-lint-ignore camelcase
+const { op_void_sync } = Deno.core.ops;
+function sync() {
+ return op_void_sync.fast();
+}
+sync(); // Warmup
+
// Void ops measure op-overhead
-Deno.bench(
- "op_void_sync",
- { n: 1e7 },
- () => Deno.core.ops.op_void_sync(),
-);
+Deno.bench("op_void_sync", () => sync());
Deno.bench(
"op_void_async",