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. --- mrbgems/mruby-struct/src/struct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mrbgems/mruby-struct/src/struct.c') diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index deab69fd9..67762a948 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -13,8 +13,8 @@ #include #include -#define RSTRUCT_LEN(st) mrb_ary_ptr(st)->len -#define RSTRUCT_PTR(st) mrb_ary_ptr(st)->ptr +#define RSTRUCT_LEN(st) RARRAY_LEN(st) +#define RSTRUCT_PTR(st) RARRAY_PTR(st) static struct RClass * struct_class(mrb_state *mrb) -- cgit v1.2.3