On 1/06/11 8:17 AM, Masaya Tarui wrote:
>
> Issue #3924 has been updated by Masaya Tarui.
>
>
>
> Hello,
>
> Require performance has been imporved a little at r31875, i think.
nice! It sure has.

> Please compare the proposal with it

			Mine	1.9.3r31923
2000 in load path	0.70	0.702834
2500 requires		0.29	5.676016
new rails app		1.08	1.346
medium rails app	10.49	10.88

The underlying algorithm is still problematic (see 2500 requires 
benchmark), but I don't have strong evidence that it is affecting 
performance of real apps given it appears to perform well on rails 
applications. Assuming no contrary evidence appears, and without 
understanding this difference further, you probably won't want to apply 
my patch for a 1.9.3 point release given the risk of regressions. I 
still think it should be given consideration for a future major release 
though.


Out of interest ... how does your commit work? Is it an optimization 
perhaps my patch could benefit from? My concern with r31875 is that it 
makes that loop even harder to understand for those not as familiar with 
that part of the code.

Cheers,
Xavier

>
> Thank you.
>
>
>
> Yusuke wrote:
>> 2011/5/31 Xavier Shay :
>>> 1.8 actually does exhibit the same performance curve, just over a greater
>>> value of N. See this graph (x-axis doubled from other benchmarks)
>> Hmm... Okay.  However, it is hard to fix this issue in 1.9.x,
>> I think.
>> To be honestly, $LOADED_FEATURES as an array is uncool, or even
>> considered as a "specification bug", though.
>
> I agree with you.
>
>
> ----------------------------------------
> Bug #3924: Performance bug (in require?)
> http://redmine.ruby-lang.org/issues/3924
>
> Author: Carsten Bormann
> Status: Open
> Priority: Normal
> Assignee:
> Category: core
> Target version: 1.9.3
> ruby -v: -
>
>
> =begin
>   Running irb<  /dev/null in 1.9.2 causes 3016 calls to lstat64.
>
>   For instance, there is a sequence of 28 repetitions each of lstat calls to all 6 non-empty path prefixes of /opt/local/lib/ruby1.9/1.9.1/irb.rb -- a total of 170 lstats apparently just to load this file; another set of lstats then occurs later for another 18 (times 6) times.  Clearly, something is running amok in the calling sequence rb_require_safe ->  realpath_rec ->  lstat.
>
>   Another example: Running a simple test with the baretest gem causes 17008 calls to lstat.  According to perftools.rb, 80 % of the 1.2 seconds of CPU is used in Kernel#gem_original_require (and another 12 in GC, some of which may be caused by this).
> =end
>
>
>