From: Yura Sokolov Date: 2011-11-01T06:54:36+09:00 Subject: [ruby-core:40581] [ruby-trunk - Feature #5427] Not complex patch to improve `require` time (load.c) Issue #5427 has been updated by Yura Sokolov. I have a report from one man about it's application startup time with and without patch: $ time ./bin/rails runner 'puts' 1.9.3-p0 without patch: real 0m22.683s user 0m21.417s sys 0m0.956s with patch: real 0m17.806s user 0m16.633s sys 0m0.892s ---------------------------------------- Feature #5427: Not complex patch to improve `require` time (load.c) http://redmine.ruby-lang.org/issues/5427 Author: Yura Sokolov Status: Open Priority: Normal Assignee: Category: Target version: Currently `loaded_features` are unsorted, so that `rb_feature_p` ought to iterate over all `loaded_features` to figure: is requested feature loaded? After this patch `loaded_features` is kept sorted by basename without extension (/usr/lib/ruby/asdf.rb => asdf). When `rb_feature_p` start its check, it goes straight to the first item with matching basename (using binary search) and stops after last. Methods `$LOADED_FEATURES.<<` and `$LOADED_FEATURES.push` are overriden to keep sort order. `push` accepts only 1 parameter, but it seems that no one pass more to it. Currently I choose to consider characters of basename in right to left order, but it could be changed, I think. https://gist.github.com/1272991 https://github.com/ruby/ruby/pull/51 -- http://redmine.ruby-lang.org