From: Luis Lavena Date: 2011-05-29T01:20:12+09:00 Subject: [ruby-core:36532] Re: [Ruby 1.9 - Bug #3924] Performance bug (in require?) On Fri, May 27, 2011 at 9:11 PM, Xavier Shay wrote: > > My last problem was related to the build system pushing things into $" and bypassing require. > > I now have a patch that I woud like to submit for consideration: > https://gist.github.com/996418 > Windows 7, x64, building with GCC 4.5.2 (32bits). Patch applied to r31761, with the following warnings: C:\Users\Luis\Projects\oss\ruby>git apply require-performance-fix-r31758.patch require-performance-fix-r31758.patch:115: trailing whitespace. /* require-performance-fix-r31758.patch:128: trailing whitespace. /* require-performance-fix-r31758.patch:648: trailing whitespace. basename = rb_funcall(rb_cFile, rb_intern("basename"), 2, require-performance-fix-r31758.patch:652: trailing whitespace. file_name_with_extension = rb_funcall(rb_cFile, rb_intern("join"), 2, require-performance-fix-r31758.patch:728: trailing whitespace. * This is the most common case, so optimize for it. If not found, fall warning: enc/make_encmake.rb has type 100644, expected 100755 warning: ext/extmk.rb has type 100644, expected 100755 warning: squelched 12 whitespace errors warning: 17 lines add whitespace errors. Details: * It compiles OK * I'm still waiting for test-all to complete (take ages on Windows) Results: https://gist.github.com/996965 If you look there, will find 2 1.9.3dev snapshots taken 1 month apart from eachother, that was my dev testbed and it got incredible better after some work done between these two revision. In your article you're not mentioning against which revision was tested, but will be great if you update it so we have more accurate information to compare. It is also worth mention that using this patch and test against "simple-bench-ruby-io" [1] to measure require speed things considerably changed: For "run" to complete, using a RAMDisk, it took: ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32] 228 features in 1.251072 secs. ruby 1.9.2p180 (2011-02-18) [i386-mingw32] 251 features in 3.931225 secs. ruby 1.9.3dev (2011-05-28 trunk 31761) [i386-mingw32] 256 features in 1.195069 secs. Your patched version: ruby 1.9.3dev (2011-05-28 trunk 31761) [i386-mingw32] 255 features in 0.711041 secs. [1] https://github.com/luislavena/simple-bench-ruby-io -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup�ry