You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
child_process takes ~20ms to run a script with execSync. If this can be optimized further, that would be great.
Use case
I have ported some bash scripts to Node.js to make them more easily cross-platform. But sometimes that means using child_process to call out to other programs (e.g. git). These calls can add up and make me think twice about the performance tradeoff.
child_process takes ~20ms to run a script with execSync
I don't think your benchmark is really measuring child_process spawn performance, just the overhead of launching node compared to bash. Comment out every line in the node script and see how little the timing changes. For me on macOS, the hyperfine-measured time goes from ~38ms to ~34ms.
Activity
H4ad commentedon Nov 25, 2023
We already tried to optimize it once: #89
anonrig commentedon Nov 25, 2023
There is still room for optimizations probably
doc: remove reference to resolved child_process v8 issue
isker commentedon Jan 15, 2024
I don't think your benchmark is really measuring child_process spawn performance, just the overhead of launching node compared to bash. Comment out every line in the node script and see how little the timing changes. For me on macOS, the hyperfine-measured time goes from ~38ms to ~34ms.
isker commentedon Jan 15, 2024
4ms is still a lot, but a lot less crazy than 20ms or 38ms 🌞.
doc: remove reference to resolved child_process v8 issue
doc: remove reference to resolved child_process v8 issue
doc: remove reference to resolved child_process v8 issue
doc: remove reference to resolved child_process v8 issue