~/talk

From slow to go: Rails test profiling hands-on

Talkat RailsConf 2024 · 2024-05-07..05-09· [testing, ruby-on-rails]
slides:none on file

Uses StackProf and speed_scope and TestProf sampling and event profilers to find concrete bottlenecks: removing coverage cuts startup ~15% (10s → 8.5s), disabling a debug gem plus enabling webpacker manifest cache saves another ~10%, Sidekiq inline work accounts for ~25% of time and switching to fake cuts it to ~2–3% so request tests drop ~30% (≈1m30s → ≈1m), Factory profiling shows popular factories and cascades, and using LetItBe replacing before with before_all halves some example times (3.5s → 1.5s); fixes are often one-line and applied with TestProf’s stamp edits (13 files patched).

AI-written summary · about

  1. 0:00Introduction
  2. 1:04Optimize slow Rails tests
  3. 8:52Profiling with stackprof
  4. 21:13Analyzing results and fixes
  5. 34:05Debugger overhead and threads
  6. 47:44Focusing test types
  7. 1:00:05Optimize Sidekick/Paperclip
  8. 1:21:49FactoryProf for factories
  9. 1:47:50Optimize before hooks
  10. 2:01:55Summary and next steps
~/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.