Fast Allocations in Ruby 3.5 | Rails at Scale
22-May-2025 22
Many Ruby applications allocate objects. What if we could make allocating objects six times faster? We can! Read on to learn more!Object allocation in Ruby 3.5 will be much faster than previous versions of Ruby. I want to start this article with benchmarks and graphs, but if you stick around I’ll also be explaining how we achieved this speedup.
For allocation benchmarks, we’ll compare types of parameters (positional and keyword) with and without YJIT enabled. We’ll also vary the number of parameters we pass to initialize so that we can see how performance changes as the number of parameters increases.
The full benchmark code can be found expanded below, but it’s basically as follows:.
Fast Allocations in Ruby 3.5 | Rails at Scale #ruby #rubydeveloper #rubyonrails #Allocations #Rails #Scale https://rubyonrails.ba/link/fast-allocations-in-ruby-3-5-rails-at-scale