~/talk

Implementing Core Set

Talkat RubyConf 2026 · 2026-07-14..07-16· [ruby]
slides:none on file

Ruby 4.0 replaces the stdlib Set with a new core implementation that uses a specialized table to drop the unnecessary hash value, yielding 33% memory savings for large sets and, after layout tweaks, about 28% smaller small-set footprints via embedded RTypedData optimizations. The add? (add predicate) path is rewritten in C to perform a single-table access under GVL, fixing the race and speeding it up. A small set C API is provided for extensions, subclass compatibility is preserved via a compatibility module, and the change is merged and working in practice.

AI-written summary · about

  1. 0:00Core Set in Ruby 4.0
  2. 1:50Standard library Set issues
  3. 3:34Design goals for Core Set
  4. 7:22Reimplementing Set in C
  5. 10:50Thread safety in Core Set
  6. 15:42Garbage collection in Core Set
  7. 18:48Backwards compatibility
  8. 23:49Memory usage comparison
  9. 27:18Optimizing small Sets
  10. 28:43Core Set C API benefits
  11. 29:25Conclusion & Q&A
~/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.