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

Slow Shell Start Up #33

Closed
kenips opened this issue Jan 24, 2013 · 7 comments
Closed

Slow Shell Start Up #33

kenips opened this issue Jan 24, 2013 · 7 comments

Comments

@kenips
Copy link

@kenips kenips commented Jan 24, 2013

Hey @carsomyr, thanks for ironing out the rbenv 0.4.0 issues. Part of the debug process you had me put in some puts statements in rehash.rb. It actually brings up that rehash is being called 4 times whenever I start a new terminal session. So I put puts "rehashing #{out_dir}" in self.rehash and I see the following lines every time:

rehashing /usr/local/Cellar/rbenv-bundler/0.95/share/rbenv/bundler
rehashing /usr/local/Cellar/rbenv-bundler/0.95/share/rbenv/bundler
rehashing /usr/local/Cellar/rbenv-bundler/0.95/share/rbenv/bundler
rehashing /usr/local/Cellar/rbenv-bundler/0.95/share/rbenv/bundler
@carsomyr
Copy link
Owner

@carsomyr carsomyr commented Jan 24, 2013

@kenips Fantastic work! That advice is now slightly out of date, though. Can you make the change mentioned at the bottom of issue #32? That'll reveal how rbenv is executing the rbenv-bundler plugin hook, which in turn is going to run rehash.rb. If there's duplicate execution, that's the reason for your slow startup times.

@kenips
Copy link
Author

@kenips kenips commented Jan 27, 2013

I think my rbenv-gemset might be screwing this test, but here it is:

/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
@carsomyr
Copy link
Owner

@carsomyr carsomyr commented Jan 27, 2013

@kenips Are you appending to the output file, or is that the result from one rehash?

@kenips
Copy link
Author

@kenips kenips commented Jan 28, 2013

@carsomyr using your suggested method it doesn't append, so I'm sure this is a single rehash. A bit out of wreck I guess?

@kenips
Copy link
Author

@kenips kenips commented Jan 28, 2013

Oops never mind, you did put another > there. Here's the output on another computer, looking much more normal:

/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash

Using rbenv bundler on would produce:

/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-bundler/0.95/etc/rbenv.d/rehash/bundler.bash
/usr/local/Cellar/rbenv-gemset/0.3.0/etc/rbenv.d/rehash/gemset.bash
/usr/local/opt/rbenv/plugins/rbenv-bundler/etc/rbenv.d/rehash/bundler.bash

So your theory stands.

@philtr
Copy link

@philtr philtr commented Mar 2, 2013

FWIW, I changed my .zshenv to rehash silently in the background on startup:

eval "$(rbenv init --no-rehash -)"
(rbenv rehash &) 2> /dev/null
@carsomyr
Copy link
Owner

@carsomyr carsomyr commented May 8, 2013

All, this seems to be fixed. The plugin's rehash hook is still slow, but I'm confident it won't get executed multiple times.

@carsomyr carsomyr closed this May 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.