From: Tanaka Akira Date: 2010-11-01T21:18:19+09:00 Subject: [ruby-core:32991] Re: [Ruby 1.9-Feature#3905][Open] rb_clear_cache_by_class() called often during GC for non-blocking I/O 2010/10/30 Tanaka Akira : > 2010/10/5, Eric Wong : >> Feature #3905: rb_clear_cache_by_class() called often during GC for >> non-blocking I/O >> http://redmine.ruby-lang.org/issues/show/3905 > >> This still causes performance problems with frequent EAGAIN compared to >> 1.9.1 >> >> While akr fixed extend to no longer clear cache with empty modules in >> r28813, >> the GC phase still scans and clears the cache when the extended object is >> collected. > > The following patch fix the problem? The following patch may be better. % svn diff --diff-cmd diff -x '-u -p' Index: vm_method.c =================================================================== --- vm_method.c (revision 29630) +++ vm_method.c (working copy) @@ -85,6 +85,9 @@ rb_clear_cache_by_class(VALUE klass) { struct cache_entry *ent, *end; + if (RCLASS_M_TBL(klass)->num_entries == 0) + return; + rb_vm_change_state(); if (!ruby_running) -- Tanaka Akira