Skip to content
  • Takashi Kokubun's avatar
    ead3bbc2
    merge revision(s) d4a1a278: [Backport #21032] · ead3bbc2
    Takashi Kokubun authored
    	rb_feature_p: skip `get_expanded_load_path` for absolute paths
    
    	Ref: https://github.com/fxn/zeitwerk/pull/308
    
    	```ruby
    	require 'benchmark'
    
    	$LOAD_PATH << 'relative-path'
    
    	autoload :FOO, '/tmp/foo.rb'
    
    	puts Benchmark.realtime {
    	  500_000.times do
    	    Object.autoload?(:FOO)
    	  end
    	}
    	```
    
    	The above script takes 2.5 seconds on `master`, and only
    	50ms on this branch.
    
    	When we're looking for a feature with an absolute path, we don't
    	need to call the expensive `get_expanded_load_path`.
    ead3bbc2
    merge revision(s) d4a1a278: [Backport #21032]
    Takashi Kokubun authored
    	rb_feature_p: skip `get_expanded_load_path` for absolute paths
    
    	Ref: https://github.com/fxn/zeitwerk/pull/308
    
    	```ruby
    	require 'benchmark'
    
    	$LOAD_PATH << 'relative-path'
    
    	autoload :FOO, '/tmp/foo.rb'
    
    	puts Benchmark.realtime {
    	  500_000.times do
    	    Object.autoload?(:FOO)
    	  end
    	}
    	```
    
    	The above script takes 2.5 seconds on `master`, and only
    	50ms on this branch.
    
    	When we're looking for a feature with an absolute path, we don't
    	need to call the expensive `get_expanded_load_path`.
Loading