diff options
author | The Bundler Bot <bot@bundler.io> | 2017-07-19 14:19:42 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-07-19 14:19:42 +0000 |
commit | 04fd47b1221edabbb46caf34798e5340bc46e1ec (patch) | |
tree | c40c05d377a8d105bf1f7330c949c056a07095b7 /lib/bundler/cli/install.rb | |
parent | 59a99983de7447b043a64b60868a90799841eef0 (diff) | |
parent | 4a8d2be31b5bd84ac1e3b3966172ec4d87e9e77b (diff) | |
download | bundler-04fd47b1221edabbb46caf34798e5340bc46e1ec.tar.gz |
Auto merge of #5844 - bundler:seg-speed-up-no-op-install, r=colby-swandale
Speed up no-op installs
### What was the end-user problem that led to this PR?
The problem was that a "no-op `bundle install`", defined as a user running `bundle install` when `bundle check` would have succeeded was taking roughly 4 times as long as `bundle check`.
Closes #5842.
### What was your diagnosis of the problem?
My diagnosis was that there were a few different bottlenecks:
- loading plugins
- using `Bundler::Worker` when the work done in that workers block would finish nearly instantly
- some unoptimized code in the parallel installer
### What is your fix for the problem, implemented in this PR?
My fix avoids the bottlenecks by checking if the `install` is guaranteed to be a no-op and short-circuiting all but the core `install` method, which in turn will now avoid the `Bundler::Worker` overhead and quickly cache gems when needed.
### Why did you choose this fix out of the possible options?
I chose this fix because it succeeded in speeding up no-op installs by a _huge_ margin.
This _should_ make `install` nearly as fast as a `bundle check`, but at the moment it's still around ~200ms slower. Not an insignificant gap, but a far cry from what it was before the patch. Additionally, since the `install` code path does things such as ensuring everything is cached.
### Time
Run against https://gist.github.com/indirect/6f60f0db1e2f86804ca3ac7c01f2afc4
```
$ time dbundle check
The Gemfile's dependencies are satisfied
BUNDLE_DISABLE_POSTIT=1 ruby ~/Development/OpenSource/bundler/exe/bundle 0.32s user 0.06s system 94% cpu 0.403 total
```
```
$ time bundle check
The Gemfile's dependencies are satisfied
BUNDLE_DISABLE_POSTIT=1 ruby ~/Development/OpenSource/bundler/exe/bundle 0.34s user 0.05s system 96% cpu 0.404 total
```
```
$ time dbundle install --quiet
BUNDLE_DISABLE_POSTIT=1 ruby ~/Development/OpenSource/bundler/exe/bundle 0.48s user 0.07s system 95% cpu 0.582 total
```
```
$ time bundle install --quiet
BUNDLE_DISABLE_POSTIT=1 ruby ~/Development/OpenSource/bundler/exe/bundle 1.68s user 0.30s system 92% cpu 2.146 total
```
Diffstat (limited to 'lib/bundler/cli/install.rb')
0 files changed, 0 insertions, 0 deletions