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:
Yukihiro "Matz" Matsumoto
2026-01-14 14:35:02 +09:00
parent 99620804c3
commit 6bd1f51f20
+1 -1
View File
@@ -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)