From: Xavier Shay Date: 2011-05-05T08:23:02+09:00 Subject: [ruby-core:36009] Re: require performance on 1.9 On 3/05/11 9:03 PM, Xavier Shay wrote: > I have tracked down the remaining performance loss from the above graph > to load.c:152. On every require, StringValuePtr is called on every > loaded feature. ruby18 does this also, but my hunch is this is more > expensive in 1.9 perhaps because of encoding or something? > > Can loaded_features ever shrink? Can a value in loaded_features change? > Is there a sane way to cache this value? Can anyone shed some light on any of these? I'm really keen to work on this I just need a pointer in the right direction. > I tried keeping a really stupid > cache of the return values in a char** but that idea crashed and burned. > > In summary, there are two problems that are making ruby 1.9 requires so > much slower than 1.8: > 1) The loaded_feature_path function, which I cannot find a use for > (load.c:158) > 2) The repeated calling of StringValuePtr (load.c:152) for every > loaded_feature on every require > > With the above two code paths disabled, require time is back down to > ruby18 levels, as per this graph*: > https://skitch.com/xaviershay/r7jid/tc-load-time > > Any ideas for progressing on #2? > > Cheers, > Xavier > > * of course, disabling #2 is definitely invalid, this is just for sake > of demonstration) >