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.
bundle exec rails
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.
bundle exec bash
This issue is related to #101, though depending on how that one is fixed, this issue may or may not be.
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.
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.
Pulled in 5940202.
Use locked env.rb in `bundle exec` if it is available. Closes issue #177