In #9379 (comment) I discuss some benchmark findings that show ShortFixnum's constantly widening and narrowing of values impacts the performance of short-ranged loops. This overhead is not enormous on Java 25 (35-40% slower) but on implementations like Java 26 and GraalVM that have better escape analysis the difference can be very large (170% slower on 26, 20x slower on GraalVM).
At the same time, ShortFixnum provides substantial size reductions, so it's a tough call whether to keep the size improvement or prefer the numeric algorithm performance.
We should consider which default is better for users and make sure the alternative is well-documented.
In #9379 (comment) I discuss some benchmark findings that show ShortFixnum's constantly widening and narrowing of values impacts the performance of short-ranged loops. This overhead is not enormous on Java 25 (35-40% slower) but on implementations like Java 26 and GraalVM that have better escape analysis the difference can be very large (170% slower on 26, 20x slower on GraalVM).
At the same time, ShortFixnum provides substantial size reductions, so it's a tough call whether to keep the size improvement or prefer the numeric algorithm performance.
We should consider which default is better for users and make sure the alternative is well-documented.