Thursday, May 22, 2025

The Digital Press

All the Bits Fit to Print

Ruby Web Development Artificial Intelligence Urban Planning Astronomy

Ruby 3.5 Boosts Object Allocation Speed Up to 6.5x Faster

Ruby 3.5 improves object allocation speed through inlining Class#new calls

From Hacker News Original Article Hacker News Discussion

Ruby 3.5 introduces a major speedup in object allocation, making it up to six times faster than Ruby 3.4.2, particularly when using keyword parameters and the YJIT compiler.

Why it matters: Faster object allocation drastically improves Ruby application performance, especially in object-heavy workloads.

The big picture: The speedup comes from inlining Class#new and optimizing method calls to reduce overhead and memory copying.

Stunning stat: Ruby 3.5 with YJIT is over 6.5x faster when initializing objects with three keyword parameters compared to Ruby 3.4.2.

Commenters say: They appreciate the detailed technical explanation and welcome the speed gains but note potential backward compatibility issues with call stack traces.