summaryrefslogtreecommitdiff
path: root/runtime/js/10_permissions.js
diff options
context:
space:
mode:
authorAapo Alasuutari <aapo.alasuutari@gmail.com>2022-08-11 16:56:56 +0300
committerGitHub <noreply@github.com>2022-08-11 15:56:56 +0200
commit2164f6b1eb7216c1045d547c94f26fe3ceaa9403 (patch)
tree056e3d6540ebd0e755650765adcff6b5cc173db8 /runtime/js/10_permissions.js
parent883269f1f183428f60c54223135d8dd25977b3cd (diff)
perf(ops): Monomorphic sync op calls (#15337)
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params). Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple: ``` opSync("op_foo", param1, param2); // -> turns to ops.op_foo(param1, param2); ``` This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path. Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
Diffstat (limited to 'runtime/js/10_permissions.js')
-rw-r--r--runtime/js/10_permissions.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/js/10_permissions.js b/runtime/js/10_permissions.js
index 4bf9db752..af66c9d2e 100644
--- a/runtime/js/10_permissions.js
+++ b/runtime/js/10_permissions.js
@@ -5,7 +5,7 @@
const {
Event,
EventTarget,
- Deno: { core },
+ Deno: { core: { ops } },
__bootstrap: { webUtil: { illegalConstructorKey } },
} = window;
const { pathFromURL } = window.__bootstrap.util;
@@ -48,7 +48,7 @@
* @returns {Deno.PermissionState}
*/
function opQuery(desc) {
- return core.opSync("op_query_permission", desc);
+ return ops.op_query_permission(desc);
}
/**
@@ -56,7 +56,7 @@
* @returns {Deno.PermissionState}
*/
function opRevoke(desc) {
- return core.opSync("op_revoke_permission", desc);
+ return ops.op_revoke_permission(desc);
}
/**
@@ -64,7 +64,7 @@
* @returns {Deno.PermissionState}
*/
function opRequest(desc) {
- return core.opSync("op_request_permission", desc);
+ return ops.op_request_permission(desc);
}
class PermissionStatus extends EventTarget {