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/node/polyfills/internal/child_process.ts | |
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/node/polyfills/internal/child_process.ts')
-rw-r--r-- | ext/node/polyfills/internal/child_process.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 39c7633e4..7f40ce94b 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -43,8 +43,11 @@ import { import { kEmptyObject } from "ext:deno_node/internal/util.mjs"; import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; import process from "node:process"; - const core = globalThis.__bootstrap.core; +const { + op_node_ipc_read, + op_node_ipc_write, +} = core.ensureFastOps(); export function mapValues<T, O>( record: Readonly<Record<string, T>>, @@ -1079,7 +1082,7 @@ export function setupChannel(target, ipc) { if (!target.connected || target.killed) { return; } - const msg = await core.opAsync("op_node_ipc_read", ipc); + const msg = await op_node_ipc_read(ipc); if (msg == null) { // Channel closed. target.disconnect(); @@ -1124,7 +1127,7 @@ export function setupChannel(target, ipc) { notImplemented("ChildProcess.send with handle"); } - core.opAsync("op_node_ipc_write", ipc, message) + op_node_ipc_write(ipc, message) .then(() => { if (callback) { process.nextTick(callback, null); |