mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
variable.c: reduce IV_INITIAL_SIZE from 4 to 2
saves 40% memory (60 -> 36 bytes) for objects with 1-2 instance variables, which is common for simple value objects like Point(@x, @y). the trade-off is one extra reallocation when growing from 2 to 4 IVs, but this is negligible since reallocations are rare compared to lookups. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ iv_new(mrb_state *mrb)
|
||||
|
||||
static void iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val);
|
||||
|
||||
#define IV_INITIAL_SIZE 4
|
||||
#define IV_INITIAL_SIZE 2
|
||||
|
||||
static void
|
||||
iv_rehash(mrb_state *mrb, iv_tbl *t)
|
||||
|
||||
Reference in New Issue
Block a user