Thursday, May 22, 2025
All the Bits Fit to Print
Ruby 3.5 improves object allocation speed through inlining Class#new calls
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.