diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-12-26 18:30:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 02:30:26 +0100 |
commit | 0efe438f7c191d8504355e03b27fe7e3055c9387 (patch) | |
tree | b96fe9a897eb6941c87a95a04520662d26c02fbe /ext/broadcast_channel/01_broadcast_channel.js | |
parent | e33c5eb704c22fad69876e87d9b852a4e5072a7a (diff) |
perf: remove opAsync (#21690)
`opAsync` requires a lookup by name on each async call. This is a
mechanical translation of all opAsync calls to ensureFastOps.
The `opAsync` API on Deno.core will be removed at a later time.
Diffstat (limited to 'ext/broadcast_channel/01_broadcast_channel.js')
-rw-r--r-- | ext/broadcast_channel/01_broadcast_channel.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/broadcast_channel/01_broadcast_channel.js b/ext/broadcast_channel/01_broadcast_channel.js index 0e95fe3cd..85f45a5d6 100644 --- a/ext/broadcast_channel/01_broadcast_channel.js +++ b/ext/broadcast_channel/01_broadcast_channel.js @@ -15,6 +15,10 @@ import { import { defer } from "ext:deno_web/02_timers.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; const { + op_broadcast_recv, + op_broadcast_send, +} = core.ensureFastOps(); +const { ArrayPrototypeIndexOf, ArrayPrototypePush, ArrayPrototypeSplice, @@ -32,7 +36,7 @@ let rid = null; async function recv() { while (channels.length > 0) { - const message = await core.opAsync("op_broadcast_recv", rid); + const message = await op_broadcast_recv(rid); if (message === null) { break; @@ -118,7 +122,7 @@ class BroadcastChannel extends EventTarget { // Send to listeners in other VMs. defer(() => { if (!this[_closed]) { - core.opAsync("op_broadcast_send", rid, this[_name], data); + op_broadcast_send(rid, this[_name], data); } }); } |