aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-11 02:38:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-11 02:38:20 +0000
commit165e10b6cf73f723c2f6af676b70aeb2d8cf85c9 (patch)
treedff6ad96b07191a39d8aca63b1e72b3aefab965b /compile.c
parentd93dcddd87b6cd99cfbbd1cd0b75613196eef615 (diff)
downloadruby-165e10b6cf73f723c2f6af676b70aeb2d8cf85c9.tar.gz
compile.c: rehash cdhash
* compile.c (iseq_compile_each, ibf_load_object_hash): rehash case-dispatch hash to reduce collisions. http://d.hatena.ne.jp/ku-ma-me/20151210 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 44e0d81aec..79cfb145ef 100644
--- a/compile.c
+++ b/compile.c
@@ -1640,6 +1640,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
data.len = len;
rb_hash_foreach(map, cdhash_set_label_i, (VALUE)&data);
+ rb_hash_rehash(map);
freeze_hide_obj(map);
generated_iseq[code_index + 1 + j] = map;
break;
@@ -7736,6 +7737,7 @@ ibf_load_object_hash(const struct ibf_load *load, const struct ibf_object_header
VALUE val = ibf_load_object(load, hash->keyval[i*2+1]);
rb_hash_aset(obj, key, val);
}
+ rb_hash_rehash(obj);
if (header->internal) rb_obj_hide(obj);
if (header->frozen) rb_obj_freeze(obj);