Skip to content

Commit

Permalink
Merge pull request #6923 from technicalpickles/bundler-settings-brack…
Browse files Browse the repository at this point in the history
…et-operator-performance

(Further) Improve Bundler::Settings#[] performance and memory usage
  • Loading branch information
martinemde committed Aug 30, 2023
2 parents c44fe8e + 75ffa8e commit 54032f3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bundler/lib/bundler/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ def initialize(root = nil)
def [](name)
key = key_for(name)

values = configs.values
values.map! {|config| config[key] }
values.compact!
value = values.first
value = nil
configs.each do |_, config|
value = config[key]
next if value.nil?
break
end

converted_value(value, name)
end
Expand Down Expand Up @@ -316,7 +318,7 @@ def key_for(key)
private

def configs
{
@configs ||= {
:temporary => @temporary,
:local => @local_config,
:env => @env_config,
Expand Down

0 comments on commit 54032f3

Please sign in to comment.