4 ms·
> you will incur into a slightly performance cost because of the bash/zsh/fish shell you need to spawn before running your code While Volta does have a shim, i
by curun1r 5y ago
> you will incur into a slightly performance cost because of the bash/zsh/fish shell you need to spawn before running your code
While Volta does have a shim, it’s written in a sensible systems language (Rust)[0], so it does not spawn a shell. It only determines the correct process and arguments to run and launches it as a subprocess. There will be overhead to read from disk and determine which version of node/npm to run and a syscall to actually launch the subprocess, but that should be very minimal and nowhere near the cost of initializing a shell.
The result is that Volta feels faster than similar tools that are written in scripting/shell languages. It also enables better Windows support since there’s no reliance on a system having a POSIX shell.
[0] https://github.com/volta-cli/volta/blob/main/src/volta-shim.rs https://github.com/volta-cli/volta/blob/main/src/volta-shim....