Skip to content

Instantly share code, notes, and snippets.

@shugo
Created September 28, 2012 09:14
Show Gist options
  • Save shugo/3798814 to your computer and use it in GitHub Desktop.
Save shugo/3798814 to your computer and use it in GitHub Desktop.
refinement performance improvement
diff --git a/vm_method.c b/vm_method.c
index e44782c..bf02c2c 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -407,8 +407,10 @@ search_method(VALUE klass, ID id, VALUE omod, VALUE *defined_class_ptr)
iclass = rb_hash_lookup(omod, klass);
if (NIL_P(iclass) && BUILTIN_TYPE(klass) == T_ICLASS) {
iclass = rb_hash_lookup(omod, RBASIC(klass)->klass);
- if (!NIL_P(iclass))
+ if (!NIL_P(iclass)) {
iclass = copy_refinement_iclass(iclass, klass);
+ rb_hash_aset(omod, klass, iclass);
+ }
}
if (!NIL_P(iclass)) {
skipped_class = klass;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment