Brighton Ruby Conference Logo

Fri 30 June, 2023
Brighton Dome

Cache me if you can: How instance variables work in CRuby

Jemma Issroff


We all use instance variables practically every time we write Ruby code. Most of us do this without a second thought for how performant instance variables accesses are or what Ruby is doing behind the scenes.

In this talk, we’ll learn what actually happens each time we access an instance variable. We’ll start with the most naive possible implementation of instance variables, iterate on it until we learn what CRuby is doing today, including how instance variable caching works, and ultimately discuss a new idea for instance variable caching that CRuby could adopt: object shapes.

Thursday, 30th June 2022