From: "hsbt (Hiroshi SHIBATA) via ruby-core" Date: 2026-06-12T05:03:13+00:00 Subject: [ruby-core:125718] [Ruby Feature#12639] Speed up require in RubyGems by 5x Issue #12639 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Assigned to Closed The performance gap this patch targeted has been mostly eliminated by incremental optimizations in RubyGems since 2016. Running the benchmark in the description on current master shows 1.47x (about 80ns per call) instead of 5x, because the require hook now returns early when there are no unresolved dependencies. Additionally, since RubyGems 3.5, Bundler disables the require decoration entirely after bundler/setup via Gem.discover_gems_on_require. The remaining overhead is too small to justify adding a new C API, so I'm closing this issue. ---------------------------------------- Feature #12639: Speed up require in RubyGems by 5x https://bugs.ruby-lang.org/issues/12639#change-117585 * Author: segiddins (Samuel Giddins) * Status: Closed * Assignee: hsbt (Hiroshi SHIBATA) ---------------------------------------- This patch makes requiring an already-loaded file approximated 5x faster when the RubyGems mixin for require is present. Benchmarked via the following script: ~~~ ruby require "rubygems" require "benchmark/ips" Benchmark.ips do |x| x.report("ruby") { gem_original_require "rubygems" } x.report("rubygems") { require "rubygems" } x.compare! end ~~~ I understand that it's not ideal to add new global functions, and I'd appreciate guidance on where else I could expose this functionality to ruby code. Thanks :) ---Files-------------------------------- feature_loaded.patch (1.85 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/