[rubygems/rubygems] Metadata dependencies can be Gem::Dependency instances

They use less memory that way.

When resolving from scratch a Gemfile including only `"gem "rails", "~>
8.0.1"`, I get the following results:

### Before

Total allocated: 265.06 MB (3186053 objects)
Total retained:  116.98 MB (1302280 objects)

### After

Total allocated: 262.99 MB (3177437 objects)
Total retained:  115.91 MB (1297821 objects)

https://github.com/rubygems/rubygems/commit/a4ef9c5f56
This commit is contained in:
David Rodríguez 2025-01-31 06:50:17 +01:00 committed by Hiroshi SHIBATA
parent 7fed6c887d
commit 24f5e3010f

View File

@ -82,7 +82,7 @@ module Bundler
def metadata_dependency(name, requirement)
return if requirement.nil? || requirement.none?
Dependency.new("#{name}\0", requirement)
Gem::Dependency.new("#{name}\0", requirement)
end
end
end