From: KOSAKI Motohiro Date: 2011-05-03T07:37:49+09:00 Subject: [ruby-core:35974] Re: require performance on 1.9 Hello, 2011/5/1 Xavier Shay : > Hello, > I am looking into the performance issues requiring files in 1.9. > Here is a graph I am trying to fix: > https://skitch.com/xaviershay/rh64d/tc-load-time > https://gist.github.com/c8d0d422a9203e1fe492 (after creating 10000 files in > the `f` dir) > > A commit from a few years back [1] adds some behaviour around > loaded_feature_path. When disabled, the require time in my benchmark is > halved [2]. There is no test covering this behaviour, and I can't quite > figure out what it is doing. > > It is probably explained in ruby-dev:31932 but I can't read Japanese: > http://markmail.org/message/d3ef53c63kx2xqkr > > Can anyone either translate the above message for me, or provide a test case > that covers the expected behaviour? I don't understand the issue. then I'll make simple translate. :-) : As I wrote [ruby-dev:31923], If I wrote : :----------------------------------- :class HOGE; end :-------------------------------------------- : :and, autoload :HOGE, 'hoge.rb' is set on ruby-1.9, require 'hoge.rb' :makes following exception. : :------------------------------------------------------------------------ :NameError: uninitialized constant HOGE : from /home/nagai/Ruby-work/hoge.rb:1:in `' :------------------------------------------------------------------------ : :ruby-1.8 works completely. :I think it's 'autoload' vs 'require' confliction issue. If I use HOGE.new instead of :'require', I've seen no issue. Is this related for your issue? > > Cheers, > Xavier > > P.S. This may or many not be related to this issue: > http://redmine.ruby-lang.org/issues/show/3924 > > [1] > https://github.com/ruby/ruby/commit/bb1f1c57823758d2450d184ce7c85beb0d538bf0 > > [2] �add continue; to load.c:161 gives 3s for n=2500 > >