Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zsh-nvm is pretty slow to load even with NVM_LAZY_LOAD=1 due to the presence of a lots of global binaries. I have ~110 global binaries installed, zprof shows that `_zsh_nvm_lazy_load` alone takes 113.23ms, causing noticable delay during shell startup. Further profiling shows that when there are a lot of global binaries, running `basename` on each of them (because `xargs -n1`) is pretty slow, the same goal could be achieved via zsh builtin expansion flags or modifiers and it's much faster. Running `which` in a for loop also has a similar but less significant drawback. After the change zsh-nvm loads in 6.03ms under same conditions. Additionally, added proper quoting to guard against binaries with whitespaces in their name. This has near to zero real-world impact but still, it is the correct thing to do.
- Loading branch information