Skip to content

benchmark: add child_process async path baselines#63929

Open
anonrig wants to merge 1 commit into
nodejs:mainfrom
anonrig:benchmark-child-process-baselines
Open

benchmark: add child_process async path baselines#63929
anonrig wants to merge 1 commit into
nodejs:mainfrom
anonrig:benchmark-child-process-baselines

Conversation

@anonrig

@anonrig anonrig commented Jun 15, 2026

Copy link
Copy Markdown
Member

Add micro-benchmarks that isolate the hot paths of the child_process async
implementation, establishing a baseline ahead of an incremental effort to move
those paths from JavaScript to C++ for performance.

Three new benchmarks under benchmark/child_process/:

  • child-process-spawn-options.js — spawns a trivial, fast-exiting child
    repeatedly while scaling the number of environment pairs and arguments, so the
    per-spawn option marshaling done in ProcessWrap::Spawn dominates the measured
    cost. Params: n, envc (0–1024), argc (0–64).
  • child-process-ipc-roundtrip.js — measures IPC round-trip throughput for
    both the json and advanced serializers across a range of payload sizes,
    keeping a window of in-flight messages so both the serialize (write) and
    deserialize (read) paths stay saturated. Params: len (64–65536),
    serialization (json/advanced), dur.
  • child-process-exec-maxbuffer.js — measures stdout accumulation and
    maxBuffer handling in execFile() by reading a fixed, large amount of child
    output into the result buffer. Params: chunks (1–64 MiB), n.

The benchmarks are intentionally black-box (real processes / real IPC) rather
than coupled to internal serialization APIs, so they remain valid as the
internals are refactored in follow-ups.

There is no runtime behavior change.

Add micro-benchmarks that isolate the hot paths targeted by the
JavaScript-to-C++ migration of child_process:

- child-process-spawn-options.js scales the env vars and args that
  ProcessWrap::Spawn must marshal across the JS/C++ boundary.
- child-process-ipc-roundtrip.js measures IPC throughput for both the
  json and advanced serializers across a range of payload sizes.
- child-process-exec-maxbuffer.js measures stdout accumulation and
  maxBuffer handling in execFile().

These establish the baseline that later migration PRs are compared
against. There is no runtime behavior change.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. child_process Issues and PRs related to the child_process subsystem. labels Jun 15, 2026
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 15, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 15, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

benchmark Issues and PRs related to the benchmark subsystem. child_process Issues and PRs related to the child_process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants