Skip to content

node --run is faster than npm run.#38

Merged
43081j merged 1 commit into
e18e:mainfrom
yoshi-taka:noderun
Sep 29, 2025
Merged

node --run is faster than npm run.#38
43081j merged 1 commit into
e18e:mainfrom
yoshi-taka:noderun

Conversation

@yoshi-taka

Copy link
Copy Markdown
Contributor

This repository uses Node.js 24, so we can take advantage of node --run, which has been available since Node.js 22.

❯ hyperfine "node --run build" "npm run build"
Benchmark 1: node --run build
  Time (mean ± σ):      91.0 ms ±   6.0 ms    [User: 177.0 ms, System: 36.7 ms]
  Range (min … max):    87.8 ms … 118.2 ms    24 runs
 
  Warning: The first benchmarking run for this command was significantly slower than the rest (118.2 ms). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
 
Benchmark 2: npm run build
  Time (mean ± σ):     173.7 ms ±  41.1 ms    [User: 240.8 ms, System: 51.6 ms]
  Range (min … max):   154.6 ms … 300.2 ms    13 runs
 
  Warning: The first benchmarking run for this command was significantly slower than the rest (212.2 ms). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
 
Summary
  node --run build ran
    1.91 ± 0.47 times faster than npm run build

see: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-4/

In my testing, bun run script was the fastest. I haven’t looked into the reasons yet, but it outperforms the others.

@43081j 43081j merged commit d23b3a4 into e18e:main Sep 29, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants