~/talk

Strings! Interpolation, Optimisation & Bugs

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

A performance regression in string interpolation traces to the VM instruction concat strings and a seven‑year‑old heuristic min_pralo_size = 48 that chose to reuse the first fragment, causing embedded strings to become extended and slowing things. Benchmarking shows removing the heuristic alone regresses ~9%, but replacing the public encoding copy with an internal fast encoding copy and always preallocating fixes the misallocation, doubles some interpolation cases and ships in Ruby 3.3 under variable width allocation.

AI-written summary · about

  1. 0:00Introduction and speaker intro
  2. 1:09Background on variable width allocation
  3. 4:45String interpolation bug discovery
  4. 7:57Investigating the interpolation code
  5. 10:01Analyzing the concat_strings instruction
  6. 12:31Diving into RB_string_concat_literals
  7. 15:00Tracing the optimization’s origin
  8. 17:48Performance impact of string resurrection
  9. 19:35Fixing the encoding safety checks
  10. 21:21Refactoring for cleaner code
  11. 22:23Benchmarking and Ruby 3.3 results
  12. 23:05Key takeaways and lessons learned
  13. 25:10Closing thanks and call to contribute
~/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.