diff options
| author | Joshua Young <djry1999@gmail.com> | 2025-06-27 23:35:35 +1000 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-07-02 11:28:23 +0900 |
| commit | 8bf13f26055d1c4eb7989b5ed846727d89da8220 (patch) | |
| tree | 6a632601a46b5a94a681610e0828021bbce6e0ed | |
| parent | d5b4b59500f00c26e19aec838adaef1baf14120c (diff) | |
Reduce allocations in `Gem::BUNDLED_GEMS.warning?`
| -rw-r--r-- | lib/bundled_gems.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index e49d6fbdcf..50fc31937c 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -99,11 +99,14 @@ module Gem::BUNDLED_GEMS # :nodoc: # and `require "syslog"` to `require "#{ARCHDIR}/syslog.so"`. feature.delete_prefix!(ARCHDIR) feature.delete_prefix!(LIBDIR) - segments = feature.split("/") + # 1. A segment for the EXACT mapping and SINCE check + # 2. A segment for the SINCE check for dashed names + # 3. A segment to check if there's a subfeature + segments = feature.split("/", 3) name = segments.shift name = EXACT[name] || name if !SINCE[name] - name = [name, segments.shift].join("-") + name = "#{name}-#{segments.shift}" return unless SINCE[name] end segments.any? |
