From: Xavier Shay Date: 2011-06-03T04:32:00+09:00 Subject: [ruby-core:36700] Re: [Ruby 1.9 - Bug #3924] Performance bug (in require?) On 31/05/11 3:55 PM, Xavier Shay wrote: > Two other options that maybe you will like: > 1) store some metadata against entries in $LOADED_FEATURES to indicate > whether they have been cached. rb_ary_push will not set this, so a quick > scan can be made of $LOADED_FEATURES on require to see if a recache is > needed > 2) On require, recache if the count of $LOADED_FEATURES does not match > the count of the cache. This isn't 100% correct --- you could rb_ary_pop > then rb_ary push to work around it --- but perhaps if more acceptable? > > I think #2 if the limitation is acceptable. Items added by rb_ary_push > would be located on the filesystem if possible (such as "./t" in your > example), other wise left as is (such as "enumerator.so"). I have put together a proof of concept of this: https://gist.github.com/8bb23db32d861cbe952f It removes the need for both lib/enumerator.rb, and the changes I made to loading mkmf in ext/exmke.rb I still need to test it with amalgamite (was on a plane so didn't have internet to get it). If you think the limitations are ok, I will work it back into my other patch set. Also, I note a change to load.c has just gone into trunk related to performance. I will add this to my list of benchmarks in the next few days. Cheers, Xavier