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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

Show comment
Hide comment
@carsomyr

carsomyr Jan 24, 2013

Owner

@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.

Owner

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

This comment has been minimized.

Show comment
Hide comment
@kenips

kenips 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

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

This comment has been minimized.

Show comment
Hide comment
@carsomyr

carsomyr Jan 27, 2013

Owner

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

Owner

carsomyr commented Jan 27, 2013

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

@kenips

This comment has been minimized.

Show comment
Hide comment
@kenips

kenips 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 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

This comment has been minimized.

Show comment
Hide comment
@kenips

kenips 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.

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

This comment has been minimized.

Show comment
Hide comment
@philtr

philtr 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

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

This comment has been minimized.

Show comment
Hide comment
@carsomyr

carsomyr May 8, 2013

Owner

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.

Owner

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