Skip to content

Performance issues changing versions on linux #926

@mockdeep

Description

@mockdeep

I'm using nvm with avn on Linux Mint and seeing some delays switching between different projects, anywhere from half a second to nearly 2 seconds, even when the version doesn't change:

$ time cd project_1
avn activated v4.2.2 (avn-nvm v4.2.2)
real    0m1.738s
user    0m1.146s
sys 0m0.829s

project_1 $ time cd ../project_2
avn activated v4.2.2 (avn-nvm v4.2.2)
real    0m1.738s
user    0m1.162s
sys 0m0.820s

project_2 $ time nvm use 4.2.2
Now using node v4.2.2 (npm v3.4.1)
real    0m0.625s
user    0m0.507s
sys 0m0.167s

For comparison, I also timed rvm switching ruby versions and it's pretty quick when changing directories:

$ time cd project_1
real    0m0.074s
user    0m0.025s
sys 0m0.072s

project_1 $ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]

project_1 $ time cd ../project_2
real    0m0.079s
user    0m0.032s
sys 0m0.067s

project_2 $ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]

What's interesting is that if I call rvm use directly, it's actually a little slower. Not sure if they do some extra checks, or if maybe they change ruby versions on cd asynchronously:

project_2 $ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]

project_2 $ time rvm use 2.2.3
Using /home/fletch/.rvm/gems/ruby-2.2.3
real    0m0.395s
user    0m0.271s
sys 0m0.133s

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs followupWe need some info or action from whoever filed this issue/PR.performanceThis relates to anything regarding the speed of using nvm.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions