From: SASADA Koichi Date: 2013-05-20T18:39:57+09:00 Subject: [ruby-core:55085] Re: [ruby-trunk - Feature #8426][Open] Implement class hierarchy method caching (2013/05/20 18:21), Charlie Somerville wrote: > funny_falcon explained this well. It's significantly faster in this case > when compared to st_table. Thanks guys, I understand. Maybe it is used to implement weak reference from super class to sub classes, right? >> It will help debugging. > I think this is a reasonable proposal. I'll add it. Thanks. >> # minor comment: `sa_' prefix is too short :P > What would you suggest? Ruby already exports symbols with short > prefixes, eg. st_. I prefer `st_' related name. But not strong opinion. One more: if (LIKELY(GET_METHOD_STATE_VERSION() == ci->vmstat && RCLASS_EXT(klass)->seq == ci->seq && klass == ci->klass)) { should be: if (LIKELY(GET_METHOD_STATE_VERSION() == ci->vmstat && klass == ci->klass && RCLASS_EXT(klass)->seq == ci->seq) { ...? why you use vmstat? if (klass == ci->klass && RCLASS_EXT(klass)->seq == ci->seq) { is not enough? Ah, you only use for re-def BasicObject, Object and Kernel. + if (klass == rb_cBasicObject || klass == rb_cObject || klass == rb_mKernel) { + INC_METHOD_STATE_VERSION(); + } else { Is it huge performance bottleneck? I think branch on inline cache should be removed. -- // SASADA Koichi at atdot dot net