From: Luis Lavena Date: 2011-05-29T01:57:21+09:00 Subject: [ruby-core:36534] [Ruby 1.9 - Bug #3924] Performance bug (in require?) Issue #3924 has been updated by Luis Lavena. Jon Forums wrote: > @Luis, if you have time, would you add results to your gist using a patched ruby_1_9_2 build? > Patch doesn't apply against 1.9.2: 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 error: patch failed: enc/make_encmake.rb:3 error: enc/make_encmake.rb: patch does not apply warning: ext/extmk.rb has type 100644, expected 100755 error: patch failed: load.c:68 error: load.c: patch does not apply error: patch failed: test/ruby/test_require.rb:339 error: test/ruby/test_require.rb: patch does not apply error: patch failed: variable.c:19 error: variable.c: patch does not apply error: patch failed: vm_core.h:324 error: vm_core.h: patch does not apply ---------------------------------------- Bug #3924: Performance bug (in require?) http://redmine.ruby-lang.org/issues/3924 Author: Carsten Bormann Status: Open Priority: Normal Assignee: Category: core Target version: 1.9.3 ruby -v: - =begin Running irb < /dev/null in 1.9.2 causes 3016 calls to lstat64. For instance, there is a sequence of 28 repetitions each of lstat calls to all 6 non-empty path prefixes of /opt/local/lib/ruby1.9/1.9.1/irb.rb -- a total of 170 lstats apparently just to load this file; another set of lstats then occurs later for another 18 (times 6) times. Clearly, something is running amok in the calling sequence rb_require_safe -> realpath_rec -> lstat. Another example: Running a simple test with the baretest gem causes 17008 calls to lstat. According to perftools.rb, 80 % of the 1.2 seconds of CPU is used in Kernel#gem_original_require (and another 12 in GC, some of which may be caused by this). =end -- http://redmine.ruby-lang.org