summaryrefslogtreecommitdiff
path: root/spec/ruby/core/array/array_spec.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2024-07-19 15:12:04 +0200
committerJean Boussier <jean.boussier@gmail.com>2024-07-22 10:33:07 +0200
commit82aee1a9467c0f1bd33eb0247c5a0a8b8b9a5049 (patch)
treebadc7d5b68f8be5641e25fb5017af6e5bb437453 /spec/ruby/core/array/array_spec.rb
parent3a16971c06a566efc04f8f156b5627bde37d21a8 (diff)
bundled_gems.rb: Add a fast path
[Bug #20641] `Gem::BUNDLED_GEMS.warning?` adds a lot of extra work on top of `require`. When the call end up atually loading code the overhead is somewhat marginal. However it's not uncommon for code to go some late `require` in some paths, so it's expected that calling `require` with something already required is somewhat fast, and `bundled_gems.rb` breaks this assumption. To avoid this, we can have a fast path that in most case allow to short-circuit all the heavy computations. If we extract the feature basename and it doesn't match any of the bundled gems we care about we can return very early. With this change `require 'date'` is now only 1.33x slower on Ruby 3.3.3, than it was on Ruby 3.2.2, whereas before this change it was at least 100x slower.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11208
Diffstat (limited to 'spec/ruby/core/array/array_spec.rb')
0 files changed, 0 insertions, 0 deletions