Lightning-Fast Method Calls with Ruby 4.1 ZJIT

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.

  • Takashi Kokubun
    Takashi Kokubun

    Takashi Kokubun is a Ruby committer and a member of Shopify's Ruby Infrastructure team. He's currently working on ZJIT, the next generation of YJIT. He has been working on JIT compilers for Ruby since 2017.