From 89cb95679dfcb15e404d03959497e5b1dda78df3 Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Thu, 31 Aug 2023 21:38:52 -0700 Subject: [PATCH] [rubygems/rubygems] Reduce excess index creation and merging When @allow_cached is true, @allow_local is always true, therefore, the #installed_specs will always be merged after #cached_specs is called. This makes starting with installed_specs.dup redundant. When #cached_specs is called because @allow_remote is true and @allow_cached is false, then installed_specs will be added after cached_specs based on @allow_local. We never need to add installed_specs here, so don't. https://github.com/rubygems/rubygems/commit/49b38f9750 --- lib/bundler/source/rubygems.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index dc82d1d33c..44102c47c8 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -380,7 +380,7 @@ module Bundler def cached_specs @cached_specs ||= begin - idx = @allow_local ? installed_specs.dup : Index.new + idx = Index.new Dir["#{cache_path}/*.gem"].each do |gemfile| s ||= Bundler.rubygems.spec_from_gem(gemfile)