[WIP] remove call to external ls when loading chruby #492
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
before
after
why?
I was trying to figure out ways to make nvm.sh load faster on my system.
chruby loads so much faster, and when I looked to see why, I was distracted by the call to
ls -A "$dir"
. It was using a builtin to list the files in the directory, but an external command to detect if there were files in the directory.So yea, I converted the already quick method to made it even faster.
~/.rubies
, and a non-existent/opt/rubies
.PREFIX
with a space in the name.This is yak shaving, and you probably can think up a better implementation. But it seems to work in
zsh
andbash
.If you prefer not to introduce change (because change always introduces risk), then that is cool. Just close.
I just saw this change and wanted to share.
As you will note,
nvm
is noticeably slower and the reason for my original tangent:Thanks again for such a great tool. And it already performs heads and shoulders better than other tools out there. (ruby or other)
refs: