ruby-changes:62244
From: Jean <ko1@a...>
Date: Wed, 15 Jul 2020 16:06:01 +0900 (JST)
Subject: [ruby-changes:62244] 40f73b3a00 (master): [rubygems/rubygems] Avoid calling LoadError#message because of its slowness
https://git.ruby-lang.org/ruby.git/commit/?id=40f73b3a00 From 40f73b3a0031e7bdbfbace37304602e0efc891fa Mon Sep 17 00:00:00 2001 From: Jean Boussier <jean.boussier@g...> Date: Sun, 28 Jun 2020 19:08:10 +0200 Subject: [rubygems/rubygems] Avoid calling LoadError#message because of its slowness Instead we can rely on `LoadError#path` https://github.com/rubygems/rubygems/commit/16d5c3b43c diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 93a801e..a58a838 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -43,14 +43,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/runtime.rb#L43 self end - REQUIRE_ERRORS = [ - /^no such file to load -- (.+)$/i, - /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, - /^Missing API definition file in (.+)$/i, - /^cannot load such file -- (.+)$/i, - /^dlopen\([^)]*\): Library not loaded: (.+)$/i, - ].freeze - def require(*groups) groups.map!(&:to_sym) groups = [:default] if groups.empty? @@ -79,16 +71,14 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/runtime.rb#L71 end end rescue LoadError => e - REQUIRE_ERRORS.find {|r| r =~ e.message } - raise if dep.autorequire || $1 != required_file + raise if dep.autorequire || e.path != required_file if dep.autorequire.nil? && dep.name.include?("-") begin namespaced_file = dep.name.tr("-", "/") Kernel.require namespaced_file rescue LoadError => e - REQUIRE_ERRORS.find {|r| r =~ e.message } - raise if $1 != namespaced_file + raise if e.path != namespaced_file end end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/