summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-struct
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 /mrbgems/mruby-struct
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 'mrbgems/mruby-struct')
-rw-r--r--mrbgems/mruby-struct/src/struct.c4
1 files changed, 2 insertions, 2 deletions
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 <mruby/hash.h>
#include <mruby/range.h>
-#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)