summaryrefslogtreecommitdiffhomepage
path: root/src/hash.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-07-27 12:46:51 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-07-27 16:13:06 +0900
commitf26d00d9e81b102fababdd9c0d1b886fab30e35a (patch)
tree057788919d060adb7d0045ef6a67cd0a7ae63d8f /src/hash.c
parent5d44f8582eb2f3011145861692d9ad42975f7a74 (diff)
downloadmruby-f26d00d9e81b102fababdd9c0d1b886fab30e35a.tar.gz
mruby-f26d00d9e81b102fababdd9c0d1b886fab30e35a.zip
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.
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c2
1 files changed, 1 insertions, 1 deletions
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);