Friday, May 23, 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 introduces inlining for Class#new to speed up object allocations.

From Hacker News Original Article Hacker News Discussion

Ruby 3.5 introduces a major optimization that makes object allocations up to six times faster by inlining the Class#new method, reducing overhead and improving performance especially with keyword parameters.

Why it matters: Faster object allocation speeds up Ruby applications, benefiting performance-critical code like Rails and Active Record.

Stunning stat: Ruby 3.5 is over 6.5 times faster than 3.4.2 for keyword parameter initialization with YJIT enabled.

The big picture: The optimization eliminates stack frames and parameter copying by inlining Class#new, improving inline cache hits and reducing method call overhead.

Commenters say: Users appreciate the deep optimization and speed gains, wonder about YJIT’s future with ZJIT, and discuss implications for Rails and broader language trends.