diff options
author | David Rodríguez <deivid.rodriguez@riseup.net> | 2022-05-13 15:56:50 +0200 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-05-16 17:24:14 +0900 |
commit | 641c3830df8177b38fcfca33d3a0ece8a2c1e7d2 (patch) | |
tree | abe7d3096d7ce42d21ac57bfbb0fbb404a19b5b3 /lib/bundler/spec_set.rb | |
parent | c380aac19d097f1d38d2299fe3f64567b42fb55d (diff) |
[rubygems/rubygems] Use `Array#concat` in `SpecSet#for` to save memory
On `rails/rails` repository Gemfile, running the following script
```
# script.rb
require "bundler/setup"
```
#### Before
```
➜ rails git:(main) ✗ BUNDLER_VERSION=2.4.0.dev ruby-memory-profiler --pretty --no-detailed --allocated-strings=0 --retained-strings=0 script.rb
Total allocated: 24.37 MB (207937 objects)
Total retained: 2.98 MB (34152 objects)
```
#### After
```
➜ rails git:(main) ✗ BUNDLER_VERSION=2.4.0.dev ruby-memory-profiler --pretty --no-detailed --allocated-strings=0 --retained-strings=0 script.rb
Total allocated: 22.27 MB (206856 objects)
Total retained: 2.98 MB (34152 objects)
```
https://github.com/rubygems/rubygems/commit/2ea2523afd
Co-authored-by: Josh Nichols <josh.nichols@gusto.com>
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r-- | lib/bundler/spec_set.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index dc55e5eaed..44715c3567 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -24,7 +24,7 @@ module Bundler specs_for_dep = spec_for_dependency(dep, match_current_platform) if specs_for_dep.any? - specs += specs_for_dep + specs.concat(specs_for_dep) specs_for_dep.first.dependencies.each do |d| next if d.type == :development |