lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm
MIT License
2.19k stars 111 forks source link

NVM_LAZY_LOAD not decreasing load time #70

Open shaharke opened 3 years ago

shaharke commented 3 years ago

I'm trying to use NVM_LAZY_LOAD to decrease the load time of my shell but it doesn't seem to have any effect.

This is my .antigenrc file

Load the oh-my-zsh's library.

antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle github
antigen bundle brew
antigen bundle nvm
antigen bundle command-not-found
antigen bundle fzf
antigen bundle docker-compose

# zsh-users bundles
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-history-substring-search

# Custom bundles
export NVM_LAZY_LOAD=true
antigen bundle lukechilds/zsh-nvm

# Load the theme.
antigen theme robbyrussell

# Tell Antigen that you're done.
antigen apply

I run the following command to time my shell:

for i in $(seq 1 4); do /usr/bin/time $SHELL -i -c exit; done

Results without NVM_LAZY_LOAD: 5.25 real 2.19 user 2.40 sys 4.15 real 1.94 user 2.06 sys 3.75 real 1.86 user 1.85 sys 3.73 real 1.85 user 1.85 sys

Result with lazy loading: 4.18 real 1.94 user 1.98 sys 3.66 real 1.83 user 1.81 sys 3.65 real 1.81 user 1.81 sys 3.59 real 1.78 user 1.78 sys

mihaiserban commented 3 years ago

same for me too..

lukechilds commented 3 years ago

You probably need to remove antigen bundle nvm or OMZ's nvm plugin since they'll load nvm.

ghost commented 3 years ago

Same here on oh-my-zsh, and I'm not loading NVM any other way AFAIK. Takes 1.6 seconds without the plugin, and 19 seconds with the plugin.

export ZSH="/home/vbersier/.oh-my-zsh"
ZSH_THEME="robbyrussell"
export FZF_DEFAULT_OPTS="--height 50% --multi --info=inline"
export FZF_BASE="/home/vbersier/.fzf/bin/fzf"
export NVM_LAZY_LOAD=true
plugins=(zsh-nvm)
plugins+=(git)
plugins+=(zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
compinit