summaryrefslogtreecommitdiff
path: root/ext/web/02_timers.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-03-31 21:28:21 +0530
committerGitHub <noreply@github.com>2023-03-31 21:28:21 +0530
commitaa9b94a80eadde7737417eb7d412559bc567c77c (patch)
tree14691957c663ad9d6c18ce837823f46e4ddc4347 /ext/web/02_timers.js
parentfeab94ff512987a9a7e01f41d7a1788712b4247c (diff)
perf(ext/websocket): use opAsync2 to avoid spread deopt (#18525)
This commit adds a new core API `opAsync2` to call an async op with atmost 2 arguments. Spread argument iterators has a pretty big perf hit when calling ops. | name | avg msg/sec/core | | --- | --- | | 1.32.1 | `127820.750000` | | #18506 | `140079.000000` | | #18506 + #18509 | `150104.250000` | | #18506 + #18509 + this | `157340.000000` |
Diffstat (limited to 'ext/web/02_timers.js')
-rw-r--r--ext/web/02_timers.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js
index 9bf41316a..c224be884 100644
--- a/ext/web/02_timers.js
+++ b/ext/web/02_timers.js
@@ -215,7 +215,7 @@ const scheduledTimers = { head: null, tail: null };
*/
function runAfterTimeout(cb, millis, timerInfo) {
const cancelRid = timerInfo.cancelRid;
- const sleepPromise = core.opAsync("op_sleep", millis, cancelRid);
+ const sleepPromise = core.opAsync2("op_sleep", millis, cancelRid);
timerInfo.promiseId = sleepPromise[SymbolFor("Deno.core.internalPromiseId")];
if (!timerInfo.isRef) {
core.unrefOp(timerInfo.promiseId);