From: Yusuke ENDOH Date: 2011-05-30T22:55:27+09:00 Subject: [ruby-core:36586] Re: [Ruby 1.9 - Bug #3924] Performance bug (in require?) Hello, 2011/5/30 Xavier Shay : >> - Please try to minimize a patch. >> � - It would be good to use the existing code as possible as you can. > I realise this would be ideal, but I can't figure out how it works, or whether it would be compatible with the new algorithm. Indeed, load.c is very complex, but I believe that this is because load.c is an accumulation of bad know-hows in the long history. So we should not throw it away without understanding, I think. >> - It is slightly disturbing to define a new class with Array inherited. >> � Is it really needed? �Is there no alternative approach? > I agree and wish there was a good alternative. Unfortunately this is necessary because $LOADED_FEATURES is treated like an array by much existing code (particularly tests), but we need it as a case-insensitive hash for the new algorithm. Perhaps the hash could be exposed directly as a class (like CaseInsensitiveHash), but this means more code, is potentially more complicated, and means we are really changing the type of $LOADED_FEATURES. Thoughts? Aha, I understand why the inheritance is used. It is to hook the array modification, right? It is an impossible approach because some extension library can modify $LOADED_FEATURES directly by rb_ary_push. I found amalgalite to do so actually: http://www.google.com/codesearch/p?hl=ja#MyfZfO3_1cw/ext/amalgalite/amalgalite3_requires_bootstrap.c&q=LOADED_FEATURES%20lang:c%20rb_ary_push&l=151 > rb_ary_push( rb_gv_get( "$LOADED_FEATURES" ), require_name ); -- Yusuke Endoh