Ruby 3.5: Six Times Faster Object Allocation via Class#new Inlining

2025-05-22
Ruby 3.5: Six Times Faster Object Allocation via Class#new Inlining

Ruby 3.5 achieves a significant speedup in object allocation, up to six times faster, by inlining the `Class#new` method. The article details this optimization, showcasing benchmark results, analyzing performance bottlenecks, and explaining the inlining technique. By eliminating method call overhead, reducing parameter copying, and improving inline cache hit rates, this optimization effectively addresses performance issues in Ruby object allocation, though it introduces minor backward compatibility concerns.

Development