~/talk

Lies, Damned Lies, and Substrings

Talkat RubyConf 2016 · 2016-11-10..11-12· [ruby, web-performance]
slides:none on file

Generates all substrings and shows the concrete costs: the average substring ≈ n/3 so naive copying makes the nested loops O(n^3), but MRI uses copy‑on‑write only when the substring includes the final NUL byte, so typical substrings are copied and the benchmark grows ≈8× when input doubles. The talk inspects memory structs with a C debugger, patched string.c macro and rebuilt Ruby to enable middle‑substring sharing, and demonstrates that creating lazy shallow slices yields O(n^2) allocation cost while full output or printing remains cubic.

AI-written summary · about

  1. 0:00Start
  2. 8:40Here's the proof.
  3. 10:51What happens if either string gets mutated?
  4. 12:49Case closed.
~/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.