~/talk

Speeding up Instance Variables with Red-Black Trees

Talkat RubyKaigi 2024 · 2024-05-15..05-17· [ruby]
slides:none on file

Ruby replaces the linear parent lookup for instance-variable shapes with a red-black tree parent cache and ports the logic to C implementation, keeping shapes immutable so no deletions are needed. Benchmarks compare Ruby 3.2.2, 3.3 and a 3.4 branch: reads and writes show cache-miss cost stops growing with the number of ivars in 3.3, and 3.4 further separates hit vs miss times; undefined-var checks also become dramatically faster.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:41What are red-black trees
  3. 4:28Functional red-black trees
  4. 15:24Object shapes and instance variables
  5. 20:33Inline caches in Ruby
  6. 22:08Why cache misses happen
  7. 25:25Ruby 3.3 red-black tree cache
  8. 26:12Benchmark results Ruby 3.2
  9. 26:33Benchmark results Ruby 3.3
  10. 28:12Undefined instance variable checks
  11. 29:18Ruby 3.4 performance gains
  12. 30:06Key takeaways and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.