Aaron Patterson
Aaron Patterson
  • @tenderlove

Aaron is on the Rails core team, the Ruby core team, and is a Senior Staff Engineer working at Shopify. In his free time, he enjoys cooking, playing with cats, and writing weird software.

Speeding up Instance Variables with Red-Black Trees

The introduction of Object Shapes helped speed up cached instance variable reads as well as decreased the machine code required for JIT compilation. But what about cache misses? Is there any way we can speed up instance variable access in that case? Ruby 3.3 introduced a red-black tree cache to speed up instance variable cache misses. Let’s learn how instance variables are implemented, and how the red black tree cache speeds them up!