Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Perf] Improve performance of listing aliases #3060

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

bbrk24
Copy link
Contributor

@bbrk24 bbrk24 commented Mar 12, 2023

Fixes #3054

Depending on the run, these changes improve the speed of npm ls by anywhere from 5% to 30% depending on the run, though it seems to average around 10%. It's not as much as I would like, but it's something.

I can get much better performance if I modify nvm_list_aliases to only have one wait call and no sort. It may be worth adding an option --unsorted which does exactly this, but I'm not familiar enough with argument parsing in sh to implement this myself.

@ljharb
Copy link
Member

ljharb commented Mar 12, 2023

I definitely wouldn't want to do that; sorting is necessary for determinism.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good! I think travis is failing rn on master, so this will have to wait on that.

Comment on lines -1381 to +1377
VERSIONS="$(command printf '%s' 'system')"
VERSIONS="system"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, this was a silly one

@ljharb ljharb added the performance This relates to anything regarding the speed of using nvm. label Mar 12, 2023
@ljharb ljharb self-assigned this Mar 12, 2023
@ljharb ljharb merged commit ffcb521 into nvm-sh:master Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance This relates to anything regarding the speed of using nvm.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

windows git bash: Listing aliases is very slow
2 participants