summaryrefslogtreecommitdiff
path: root/core/01_core.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-10-03 21:02:50 +0200
committerGitHub <noreply@github.com>2021-10-03 21:02:50 +0200
commit11acdf1ea8b2978dcacad37b386f45e43a1f2748 (patch)
treeee3d75bc4c1611f4ff3d4ccbbc043504c6584e17 /core/01_core.js
parent2170a41d975dbdc4680eb0ea346fdb5056bfa57b (diff)
perf(core): use opcall() directly (#12310)
Instead of the wrapper dispatch() func, also now forbids passing opIds to opSync()/opAsync() callers must always pass names
Diffstat (limited to 'core/01_core.js')
-rw-r--r--core/01_core.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/core/01_core.js b/core/01_core.js
index 296d9bbcf..44267e6fc 100644
--- a/core/01_core.js
+++ b/core/01_core.js
@@ -97,11 +97,6 @@
}
}
- function dispatch(opName, promiseId, control, zeroCopy) {
- const opId = typeof opName === "string" ? opsCache[opName] : opName;
- return opcall(opId, promiseId, control, zeroCopy);
- }
-
function registerErrorClass(className, errorClass) {
registerErrorBuilder(className, (msg) => new errorClass(msg));
}
@@ -130,14 +125,14 @@
function opAsync(opName, arg1 = null, arg2 = null) {
const promiseId = nextPromiseId++;
- const maybeError = dispatch(opName, promiseId, arg1, arg2);
+ const maybeError = opcall(opsCache[opName], promiseId, arg1, arg2);
// Handle sync error (e.g: error parsing args)
if (maybeError) return unwrapOpResult(maybeError);
return PromisePrototypeThen(setPromise(promiseId), unwrapOpResult);
}
function opSync(opName, arg1 = null, arg2 = null) {
- return unwrapOpResult(dispatch(opName, null, arg1, arg2));
+ return unwrapOpResult(opcall(opsCache[opName], null, arg1, arg2));
}
function resources() {