From slow to go: Rails test profiling hands-on
summary
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
chapters (10)
- 0:00Introduction
- 1:04Optimize slow Rails tests
- 8:52Profiling with stackprof
- 21:13Analyzing results and fixes
- 34:05Debugger overhead and threads
- 47:44Focusing test types
- 1:00:05Optimize Sidekick/Paperclip
- 1:21:49FactoryProf for factories
- 1:47:50Optimize before hooks
- 2:01:55Summary and next steps
related talks
38mTake your slow tests to the doctor
01h 02mPerformance
41mSpeed up Rails, Speed up Your Code
09mSpeeding Up Your Test Suite
30mDevelopment Speed Optimizations in Rails 8
29mYour test suite is making too many database calls!
28mWhen Can You Skip a Test? Tracking Test Impact
35m"10 performance sins of Rails applications"
