`bundle exec rails` much slower than just `rails` #177

rsutphin opened this Issue Mar 4, 2010 · 3 comments


None yet

2 participants

rsutphin commented Mar 4, 2010

I have a rails plugin whose cucumber integrated tests generate a rails app, install the plugin in it, and tests it. When I switched it from bundler 0.8.1 to bundler 0.9.9, running the features got much slower (one feature which formerly took ~1m to run now takes 3m). I tracked this to bundle exec being very slow. Here's a gist with isolated, repeatable performance results. It shows that bundle exec rails is more than 3x slower than just running rails or running bin/rails under bundler08.

I also tried (but did not document on the gist) bundle exec bash and then running rails in the resulting shell. This is slightly faster, but still closer to 3x than 2x as slow as without bundle exec.

This issue is related to #101, though depending on how that one is fixed, this issue may or may not be.

rsutphin commented Mar 4, 2010

Poking a bit at how bundle exec works, it seems that most of the overhead (~2.1s out of ~2.5s) is in running Bundle.setup before every ruby process. If the application is locked, then running setup is redundant -- we should just be able to load .bundle/environment.rb, right?

I'll put together a patch to do that if .bundle/environment.rb is available and to call setup otherwise. Please let me know if I'm missing something.

rsutphin commented Mar 4, 2010

Here's the patch: http://github.com/rsutphin/bundler/commit/93a4e5d90ce091308ebff942e6cb031f72944c04

I've updated the original gist with the performance with this patch applied. I've also tested my original cucumber suite with it and found it to be nearly as fast as under bundler08.

indirect commented Mar 4, 2010

Pulled in 5940202.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment