Skip to content

Conversation

@deivid-rodriguez
Copy link
Contributor

@deivid-rodriguez deivid-rodriguez commented Aug 24, 2022

What was the end-user or developer problem that led to this PR?

Trying to make Bundler faster and simplify code at the same time.

What is your fix for the problem, implemented in this PR?

Improve bundler/setup time by ~2% in the big Gemfile I commonly use for testing performance (https://github.com/technicalpickles/big-gemfile), although it does not improve simpler setups like a brand new Rails app.

✗ hyperfine 'BUNDLER_VERSION=2.3.22 ruby -rbundler/setup -e1' 'BUNDLER_VERSION=2.4.0.dev ruby -rbundler/setup -e1'  --warmup 3
Benchmark 1: BUNDLER_VERSION=2.3.22 ruby -rbundler/setup -e1
  Time (mean ± σ):     141.4 ms ±   1.0 ms    [User: 112.5 ms, System: 27.6 ms]
  Range (min … max):   139.9 ms … 143.1 ms    20 runs
 
Benchmark 2: BUNDLER_VERSION=2.4.0.dev ruby -rbundler/setup -e1
  Time (mean ± σ):     139.0 ms ±   2.4 ms    [User: 109.4 ms, System: 27.6 ms]
  Range (min … max):   136.8 ms … 147.6 ms    21 runs
 
Summary
  'BUNDLER_VERSION=2.4.0.dev ruby -rbundler/setup -e1' ran
    1.02 ± 0.02 times faster than 'BUNDLER_VERSION=2.3.22 ruby -rbundler/setup -e1'

The main idea is to not sort specs unnecessarily when not needed although there are other misc improvements in the PR.

Make sure the following tasks are checked

@deivid-rodriguez deivid-rodriguez force-pushed the speedup-again branch 2 times, most recently from 0dc0b20 to c82d62b Compare August 25, 2022 16:41
Specs in a SpecSet with the same name are only sorted by platform
priority when they are read. No need to sort everything eagerly.
Already done by the gem version promoter.
Instead of checking for uniqueness for every spec.
@deivid-rodriguez deivid-rodriguez marked this pull request as ready for review September 9, 2022 03:31
@deivid-rodriguez deivid-rodriguez changed the title Speeding up Bundler more Further speed up Bundler by not sorting specs unnecessarily Sep 12, 2022
@deivid-rodriguez deivid-rodriguez merged commit 67e6e19 into master Sep 12, 2022
@deivid-rodriguez deivid-rodriguez deleted the speedup-again branch September 12, 2022 13:13
deivid-rodriguez added a commit that referenced this pull request Oct 5, 2022
Speeding up Bundler more

(cherry picked from commit 67e6e19)
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Oct 12, 2022
https://build.opensuse.org/request/show/1010049
by user coolo + dimstar_suse
updated to version 2.3.23
 see installed CHANGELOG.md
  # 2.3.23 (October 5, 2022)

  ## Enhancements:

    - Update GitLab CI template with new one [#5944](ruby/rubygems#5944)

  ## Bug fixes:

    - Fix `bundle init` not respecting umask in generated gem's Gemfile [#5947](ruby/rubygems#5947)

  ## Performance:

    - Further speed up Bundler by not sorting specs unnecessarily [#5868](ruby/rubygems#5868)

  ## Documentation:

    - Update Bundler new feature instructions [#5912](ruby/rubygems#5912)

  # 2.3.22 (September 7, 2022)

  ## Enhancements:

    - Use a more accurate source code uri in gemspec [#5896](ruby/rubygems#5896)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants