Commit graph

56 commits

Author SHA1 Message Date
Samuel Giddins
c423d6e0e4 [rubygems/rubygems] Stop allocating the same settings keys repeatedly
Running `bundle update --bundler` on a rails app locally:

```
==> memprof.after.txt <==
Total allocated: 301.90 kB (3794 objects)
Total retained:  73.24 kB (698 objects)

==> memprof.before.txt <==
Total allocated: 14.47 MB (196378 objects)
Total retained:  25.93 kB (202 objects)
```

So for a slight increase in retained memory (all keys are now retained),
we go from about 200k allocations in the settings file to under 4k

e64debb6ae
2023-09-15 17:54:01 +00:00
Josh Nichols
e747e2c36b [rubygems/rubygems] Update bundler/lib/bundler/settings.rb
75ffa8ef76

Co-authored-by: Martin Emde <martinemde@users.noreply.github.com>
2023-08-30 00:36:38 +00:00
Josh Nichols
6a876a61d7 [rubygems/rubygems] (Further) Improve Bundler::Settings#[] performance and memory usage
I previously identified and improved this method over in https://github.com/rubygems/rubygems/pull/6884
but while reviewing another memory_profiler profile, I realized another
gain we can eek out.

This method keeps comes up in part because `configs` is allocating a new
Hash every time. My last change took advantage of that by using `map!`
on it. `configs` is called quite often, including in this `[]` method,
so there's a benefit to memoizing it.

Back in `[]`, logically we are trying to find the first Hash in `configs`
that has a value for the given key. Currently, we end up `map` and
`compact` to just get that value.

Instead, we can use a loop over `configs`, and break when we find the
value for the key.

b913cfc87b
2023-08-30 00:36:38 +00:00
Josh Nichols
3544200513 [rubygems/rubygems] fix lint
75c0f27b7e
2023-08-20 09:07:11 +00:00
Josh Nichols
7c4431e61c [rubygems/rubygems] use a one-liner
46745885e8
2023-08-20 09:07:05 +00:00
Josh Nichols
e5efa01c7d [rubygems/rubygems] handle removing BUNDLE_, since using start_with? would still include that
235d9b38d8
2023-08-20 09:07:00 +00:00
Martin Emde
f0bf9391dc [rubygems/rubygems] Don't rely on globals when not matching regexp for "local."
e79ccdafd8
2023-08-20 09:06:54 +00:00
Josh Nichols
b5a0630cd0 [rubygems/rubygems] Use ! methods once we have a new copy of the string. Use .prepend to avoid allocating a new string.
2ac35a661f
2023-08-20 09:06:48 +00:00
Josh Nichols
29aab66e6b [rubygems/rubygems] call key.to_s once instead of multiple times to save when it's a symbol
535feb817c
2023-08-20 09:06:43 +00:00
Josh Nichols
239e35254b [rubygems/rubygems] Use value.match? only on Strings, which avoids allocating a matchdata, which is not used
cbf9ac93d7
2023-08-20 09:06:36 +00:00
Josh Nichols
598048e3dd [rubygems/rubygems] Use .to_s once in the beginning to save allocations if it's a symbol.
f8167db8a2
2023-08-20 09:06:31 +00:00
Josh Nichols
e921efa476 [rubygems/rubygems] name is often a symbol, so only to_s once to avoid allocating it multiple times
8eac49c429
2023-08-20 09:06:25 +00:00
Josh Nichols
7cb6cbee95 [rubygems/rubygems] String#start_with? is faster than regex with beginning boundaries
d7cde68034
2023-08-20 09:06:19 +00:00
Josh Nichols
b97e45d01a [rubygems/rubygems] Use ! methods on the array, since it is brand new. The individual keys are also new, so we can use ! methods on each individual one as well.
f2e912b9bb
2023-08-20 09:06:12 +00:00
Josh Nichols
2a61e1dccc [rubygems/rubygems] Use Array#union to join these, instead of with | multiple times. This saves allocating 2 arrays
48c03b33b7
2023-08-20 09:06:07 +00:00
Josh Nichols
79b187a45e [rubygems/rubygems] config is a new Hash, and config.values is a new Array. that means we can use bang methods to avoid allocating new copies
8bc13fa55f
2023-08-20 09:06:01 +00:00
Josh Nichols
921c2bba4e [rubygems/rubygems] ENV.to_h returns a new hash, so we can select! it to avoid allocating another hash.
`String#start_with?` is faster than regex that is bound to the start of
a string.

9b2006ef09
2023-08-20 09:05:56 +00:00
Hiroshi SHIBATA
dd1af4b22d
[rubygems/rubygems] Rename local to lockfile and global to system
456fd05d3a
2023-07-24 15:04:24 +09:00
David Rodríguez
0b0df03b0d
[rubygems/rubygems] Avoid printing using messages when version has not changed
9635a2fd74
2023-07-24 15:03:15 +09:00
Hiroshi SHIBATA
f16c880f77
[rubygems/rubygems] Introduce bundle config set version feature
c431a1df52
2023-07-13 11:36:03 +09:00
David Rodríguez
03246719cc [rubygems/rubygems] Fix path vs deployment precedence when path set through ENV
The `deployment` setting sets `path` to `vendor/bundle` implicitly, but
that should only apply if `path` is not set explicitly, at any level.

3552c064c1
2023-06-06 10:52:57 +09:00
Hiroshi SHIBATA
d1c42da7a1 [rubygems/rubygems] To use Gem::YAMLSerializer in Bundler
5351e01b32
2023-04-19 06:56:24 +00:00
Hiroshi SHIBATA
7b959f6288 [rubygems/rubygems] Move all changes only in RubyGems
d842e2092f
2023-04-19 06:56:20 +00:00
Hiroshi SHIBATA
bf8d8ce1ee [rubygems/rubygems] Keep compatiblity of Bundler specs
b211eeacba
2023-04-19 06:56:18 +00:00
David Rodríguez
ddc4fd5644 Normalize git sources
Just like gem sources, a "style-only" change, like adding a trailing
slash, should not expire them.
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
3eca1e438d Merge 16c3535413 2022-09-05 14:37:12 +09:00
Hiroshi SHIBATA
bfd09b1116 Merge rubygems master from 446cc57a7c 2022-07-29 15:46:15 +09:00
David Rodríguez
d6684f063b [rubygems/rubygems] Fix crash when commenting out a mirror in configuration
2d99277328
2022-05-30 17:43:12 +09:00
Hiroshi SHIBATA
ff3d7b720e Merge RubyGems and Bundler master 2022-02-28 11:39:20 +09:00
Hiroshi SHIBATA
da6a5e3ed1 Merge RubyGems-3.3.3 and Bundler-2.3.3 2021-12-25 07:40:52 +09:00
Matt Larraz
5f205073d2 [rubygems/rubygems] Pass second argument to Array#split to ensure only two values returned
601b5553bb
2021-08-31 19:06:14 +09:00
Matt Larraz
2aed061384 [rubygems/rubygems] Correctly redact credentials when using x-oauth-basic
290b6ab078
2021-08-31 19:06:14 +09:00
David Rodríguez
21db5876ca [rubygems/rubygems] Respect BUNDLE_USER_HOME for global config location
58fc31442f
2021-08-31 19:06:14 +09:00
David Rodríguez
0ab160e2e0 [rubygems/rubygems] Respect BUNDLE_USER_CONFIG if set
f28ab141af
2021-08-31 19:06:14 +09:00
Hiroshi SHIBATA
896bbb9fad Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9 2021-07-14 10:48:07 +09:00
David Rodríguez
6e2240a2f9 Sync latest bundler & rubygems development version 2021-07-07 13:30:20 +09:00
David Rodríguez
5b0abba931 Sync bundler & rubygems 2021-05-11 11:29:41 +09:00
Hiroshi SHIBATA
ed149dbf46 Merge the master branch of Bundler 2021-04-15 15:36:15 +09:00
David Rodríguez
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Hiroshi SHIBATA
473f9d2df0 Merge prepare version of Bundler 2.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
d386a58f6f Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
Hiroshi SHIBATA
c7ebeb7eda Sync Bundler PR #3624 2020-05-22 20:32:30 +09:00
Hiroshi SHIBATA
0e60b59d58 Update the bundler version with master branch 2020-05-13 07:54:37 +09:00
Hiroshi SHIBATA
38002a8adb Prepare to release bundler-2.1.0 2019-12-15 16:41:10 +09:00
David Rodríguez
f18d88b535
[bundler/bundler] Revert "Remove now meaningless setting"
This reverts commit 52c5a0eedec34b5d86464b3cf135dc2002486f1d.

b4cc36deb9
2019-09-18 18:26:32 +09:00
David Rodríguez
4f5e1b6ebf
[bundler/bundler] Remove cache_command_is_package feature flag
So that we handle the removal of `bundle cache` just like we'll handle
the removal of `bundle show` and `bundle console`.

ff1a669efb
2019-08-03 09:29:58 +09:00
David Rodríguez
6492f23d91
[bundler/bundler] Remove now meaningless setting
52c5a0eede
2019-08-03 09:29:57 +09:00
Hiroshi SHIBATA
8f37629519 Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
2019-06-09 12:44:10 +09:00
hsbt
68ddd4d300 Merge Bundler 2.1.0.pre.1 as developed version from upstream.
a53709556b

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14 06:01:35 +00:00
hsbt
e97741e12a Merge Bundler 2.0.1 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 13:10:58 +00:00