summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authorJean byroot Boussier <jean.boussier+github@shopify.com>2024-07-23 01:35:22 +0200
committerGitHub <noreply@github.com>2024-07-22 16:35:22 -0700
commit4667f8ec10269b0b5deca459f098abbdf3bae4ec (patch)
treef45c22083ad90ac7efa2affed4001e874dd1fa46 /include/ruby
parent425e468d25a70740cef3ed676e9b82f7902e077a (diff)
bundled_gems.rb: Add a fast path (#11221)
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. Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Diffstat (limited to 'include/ruby')
0 files changed, 0 insertions, 0 deletions