One of the largest sources of slowness in Ruby is the overhead associated with method calls. While recent versions of Ruby have seen YJIT enhance method call performance by optimizing machine code for various method call types, a significant bottleneck remains: the process of pushing a Ruby method frame.
In this talk, we will explore the various elements Ruby needs to handle within method frames and unveil our approach to making this process nearly zero-cost with ZJIT's Lightweight Frames and method inlining. Additionally, we will discuss the compelling reasons to transition from YJIT to ZJIT in Ruby 4.1, highlighting the performance benefits you can expect.