Commit d21a55f0
d21a55f09b37Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
perf: relax value-type detection limit from 4 to 8 ivars
Classes with up to 8 scalar ivars can now be value-typed (struct on stack, no GC allocation) when they satisfy the other criteria (no attr_writer, no self-mutation, no inheritance).
Covers Vec4, Matrix2x2, Color (RGBA), and similar small bundles that previously fell off the value-type optimization cliff.
75/75 tests pass, 52 benchmarks pass, bootstrap stable.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- d21a55f09b37
- Parent
- a5247103840f
spinel_codegen.rbmodifiedView file
@@ -8639,7 +8639,9 @@
86398639
while i < @cls_names.length86408640
names = @cls_ivar_names[i].split(";")86418641
types = @cls_ivar_types[i].split(";")8642-
if names.length > 0 && names.length <= 48642+
# Value-type candidates: small immutable scalar classes.8643+
# Limit to 8 ivars so the struct stays register-friendly.8644+
if names.length > 0 && names.length <= 886438645
all_val = 186448646
j = 086458647
while j < types.length