-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
rbenv calls taking too much time #804
Comments
Is every rbenv command taking a long time, such as Also, some more information about your system would be helpful: |
Thanks for the response. I'm testing on OS X Yosemite From my benchmarks
This is on
I'm not sure what the normal run times for rbenv are so if someone could help me out by posting those that would be great. |
Now that I compare it against my system, ~8.7 In your shell prompt, however, you seem to be invoking rbenv twice:
Both of these commands are much faster than plain TIMEFORMAT=%3R
for i in {1..100}; do time rbenv version-name >/dev/null; done 2>&1 | awk '{ d+=$1 } END { print d/FNR }'
0.02943 # average execution time in seconds However, these 2 commands can together still take up to 60ms to execute in sequence, and that's unacceptable for a shell prompt in my opinion. Rbenv is going to get faster in the next release due to dynamically loaded C extension, and I've also been toying with a rbenv rewrite in Go which is already silly fast, but in the meantime I suggest that you avoid calling rbenv commands in your prompt. Here are some alternatives:
Does that help at all? |
Thanks for the feedback. Not sure about why the normal Your suggestions do make for a great improvement but it would be nice of course if the commands themselves were fast as well :) |
The help string is actually compiled from bits of help text from individual commands. That's why it's slow. It's fine that this is slow, however, since you're not often calling However, yes I want commands like In the upcoming version of rbenv, for instance, |
Closing because rbenv speed is being actively worked on, and because you've been given alternatives for your shell prompt. Thanks for raising this issue! |
One question - are the speed-ups going into the next version currently in master or in a separate branch? (this is in case I find a few things to speed-up and to avoid making a duplicate PR) |
They are in master. To enable, install rbenv from master branch and run |
Hello,
So this seems to have happened quite recently and I'm not quite sure what to look for to fix this - but recently
rbenv
calls are taking a particular long time to resolve. This a very noticeable because my shell_prompt uses 3 rbenv calls to generate the promptif type rbenv >/dev/null 2>&1
,set ruby_version (rbenv version-name)
and[ "$ruby_version" = (rbenv global) ]; and return
.Here is what I get for a benchmark (~8.7
rbenv
calls per second):The text was updated successfully, but these errors were encountered: