Measured Node.js 22.12.0

Benchmarks

node-cmd delegates to Node’s own child-process primitives. These measurements isolate the JavaScript wrapper and then time real child completion, so convenience never hides its cost.

10.40 nslargest median dispatch delta
39–55 msempty process median
≈ 3.8M×process time versus max wrapper delta
0runtime dependencies
01 / Result

The wrapper stays beneath the work it controls

Common callback, Promise, direct-file, and streaming paths added medians of 0.21–0.22 ns over the matching node:child_process call. The two synchronous result envelopes added 7.56 ns and 10.40 ns. Even the larger value is about 3.8 million times smaller than its matching empty-process completion time.

What this proves. node-cmd’s measured JavaScript dispatch cost is negligible beside process creation on this reference system. It does not claim to make Node or the operating system launch processes faster.
02 / JavaScript dispatch

Nanoseconds before a process exists

The child-process functions were replaced temporarily with counter stubs in an isolated measurement setup. This removes operating-system launch noise and exposes only argument normalization, result-envelope construction, and function dispatch. Bars show median nanoseconds per call; lower is better.

Median dispatch cost0–15 ns per call
node:child_processnode-cmd
run
2.081 ns
2.286 ns
runPromise
2.091 ns
2.316 ns
runSync
2.126 ns
9.701 ns
runFile
2.107 ns
2.321 ns
runFilePromise
2.083 ns
2.295 ns
runFileSync
2.117 ns
12.483 ns
runStream
2.100 ns
2.318 ns
node-cmd APIPaired median delta95% bootstrap CIInterpretation
run+0.211 ns+0.203 to +0.220Dispatch measured
runPromise+0.217 ns+0.209 to +0.229Dispatch measured
runSync+7.562 ns+7.486 to +7.614Result normalization measured
runFile+0.211 ns+0.204 to +0.219Overload dispatch measured
runFilePromise+0.213 ns+0.204 to +0.224Overload dispatch measured
runFileSync+10.402 ns+10.241 to +10.484Options + result normalization measured
runStream+0.218 ns+0.204 to +0.227Overload dispatch measured
03 / Real process completion

The wrapper tracks Node through the operating system

Each implementation started the same empty Node.js executable with identical options. The run* scenarios include the platform shell plus that child; runFile* and runStream() start the child directly. The direct and node-cmd calls ran sequentially, with first position alternating to reduce order bias. Bars show median completion time; lower is better.

Empty child completion0–60 ms
node:child_processnode-cmd
run · callback
53.040 ms
52.859 ms
runPromise
53.712 ms
53.787 ms
runSync
54.495 ms
54.617 ms
runFile · callback
42.452 ms
41.932 ms
runFilePromise
40.393 ms
40.140 ms
runFileSync
39.508 ms
39.485 ms
runStream
39.121 ms
38.886 ms
node-cmd APINode direct p50node-cmd p50Paired-delta 95% CI
run53.040 ms52.859 ms−0.716 to +0.235 ms
runPromise53.712 ms53.787 ms−0.985 to +0.600 ms
runSync54.495 ms54.617 ms−0.853 to +1.536 ms
runFile42.452 ms41.932 ms−1.145 to +0.146 ms
runFilePromise40.393 ms40.140 ms−1.135 to +0.460 ms
runFileSync39.508 ms39.485 ms−0.793 to +0.189 ms
runStream39.121 ms38.886 ms−0.874 to +0.218 ms

All seven paired-delta confidence intervals include zero, so this run did not resolve a completion-time difference. That is a statement about detection at this sample size—not proof that the implementations are mathematically equivalent.

04 / Method

Reference environment and controls

InputReference valueWhy it matters
RuntimeNode.js 22.12.0 · V8 12.4The exact supported runtime floor
Source identitySHA-256 for runtime and both benchmark scriptsFull hashes are included in the raw report
HostWindows x64 · Intel Core Ultra 9 275HX · 24 logical CPUsAbsolute launch time is machine-specific
Process suite20 warm-ups + 100 balanced pairs per APISequential calls and alternating order reduce interference
Dispatch suite100 calibrated batches per APIAt least 100,000 calls per batch; raw batches retained
Intervals2,000 deterministic bootstrap resamplesReports uncertainty around the paired median
Source parityCommonJS and ESM identity asserted before timingBoth module systems use the same implementation
Read the machine, not a universal constant. Absolute process-launch time varies with hardware, operating system, load, security software, and the executable. Compare trends and wrapper scale; reproduce on the environment that matters to you.
05 / Reproduce

Run the dependency-free harness yourself

node ./benchmark/run.js --samples 100 --warmups 20 --output ./benchmark/reference.json
npm run benchmark:chart

The harness uses Node built-ins only. It preserves every process pair and dispatch batch in benchmark-results.json; the README charts are regenerated directly from that file.