diff options
| author | Josh Nichols <josh.nichols@gusto.com> | 2023-08-28 20:02:08 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-08-30 00:36:38 +0000 |
| commit | 6a876a61d7495ff64805cdda2756c5fc38846ef8 (patch) | |
| tree | 29af3dbf12b8deb4d747cc3d92752d5d1beb3b91 /lib/unicode_normalize | |
| parent | 27024004fa9804631c6f21e2022bb2dd690e8c5c (diff) | |
[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.
https://github.com/rubygems/rubygems/commit/b913cfc87b
Diffstat (limited to 'lib/unicode_normalize')
0 files changed, 0 insertions, 0 deletions
