From f26d00d9e81b102fababdd9c0d1b886fab30e35a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 27 Jul 2017 12:46:51 +0900 Subject: Embed small size array elements in the heap. It reduces the memory consumption and sometimes improve the performance as well. For example, the consumed memory size of `bench/bm_ao_render.rb` is reduced from 1.2GB to 1GB, and its total execution time become 18.795 sec from 22.229 sec. --- src/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/hash.c') diff --git a/src/hash.c b/src/hash.c index c292f6b67..27d25b384 100644 --- a/src/hash.c +++ b/src/hash.c @@ -759,7 +759,7 @@ mrb_hash_keys(mrb_state *mrb, mrb_value hash) ary = mrb_ary_new_capa(mrb, kh_size(h)); end = kh_size(h)-1; mrb_ary_set(mrb, ary, end, mrb_nil_value()); - p = mrb_ary_ptr(ary)->ptr; + p = RARRAY_PTR(ary); for (k = kh_begin(h); k != kh_end(h); k++) { if (kh_exist(h, k)) { mrb_value kv = kh_key(h, k); -- cgit v1.2.3