~/talk

Understanding Ruby's Method Cache

Talkat Wicked Good Ruby 2013 · 2013-10-12..10-13· [ruby]
links:none on file
slides:none on file

Ruby 1.9 (YARV) compiles bytecode and installs an inline method cache so a method lookup done once can skip subsequent searches (call it 10 times, resolve once and save nine lookups), but the cache records a global state generation and most mutations (define_method, alias, changing constants, OpenStruct, autoload, refinements) bump that generation and invalidate everything. Profiling shows real sites repeatedly rebuild caches; James Golick prototypes James Golick's class‑contextual generations which limits invalidation to affected classes and measurably reduces wasted lookups.

AI-written summary · about

  1. 0:00Start
  2. 3:59UNDERSTAND THE STACK
  3. 4:46WHAT IS METHOD RESOLUTION??
  4. 7:27Method Resolution in other languages Method Resolution in Ruby
  5. 7:55METHOD RESOLUTION IN RUBY 18
  6. 12:08METHOD RESOLUTION IN RUBY 19 (now with YARV!!)
  7. 22:11GENERATIONAL CACHE EXPIRATION
  8. 26:48WAIT, OPENSTRUCT INVALIDATES THE CACHE??
  9. 27:48REFINEMENTS
  10. 28:11MRI 1.9 method caching
  11. 28:24THE FUTURE
  12. 31:14CONCLUSIONS
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.