prezto
prezto copied to clipboard
adding node module slows startup time
Hi 👋
Related issue #1230
Description
When compared to oh-my-zsh, Prezto is fast! I am comparing 1s to 100ms.
However as soon as one adds the node module which loads NVM, a whole second or more is added to the startup time. There was a long discussion https://github.com/robbyrussell/oh-my-zsh/issues/5327 and some people found clever solutions. The one I like the most is only loading nvm once a node related command is executed.
Expected behavior
Modules should be lightweight and barely change the speed of the terminal experience.
Actual behavior
As soon as node is installed the startup time slows down by a few seconds.
Steps to Reproduce
- add
node
to your module list - open a new terminal while paying attention to when you get the first prompt
Versions
- Prezto commit: 4abbc5572149baa6a5e7e38393a4b2006f01024f
- ZSH version: 5.6.2 (x86_64-apple-darwin18.2.0)
- OS information: macOS Mojave 10.14.2
Thanks 💚
Do you use NVM? I have that behaviour with NVM loaded as a plugin or if I source it manually.
@muuvmuuv I use nodenv and it's part of the reason why it's slow, if I recall correctly I fixed this by making nodenv lazy, meaning it doesn't always check or load on every cd, but only when I trigger something that would need node.
So it is more like a nodenv/nvm issue than a prezto performance problem. I experience exactly the same with NVM...
Benchmarked with time zsh -i -c exit
.
With node: 0.56s Without node: 0.07s
Node module removed until fixed.
@muuvmuuv how did you fix? Was there a PR?
I have just removed the auto script (I mean the node plugin) and initial NVM manually which is fine