Tidying Active Record Allocations
summary
Uses memory_profiler and derailed benchmarks against CodeTriage to find ActiveRecord allocation hotspots, then patches two real hotspots: replace per-call symbol-to-string conversion in respond_to with a symbol-keyed hash (avoids array iteration) and avoid string→Time→string roundtrip when building cache keys by reformatting the DB string directly. The patches cut total allocations ~1% and ~5%, give ~1.01x and ~1.12x request speedups respectively, and combine to ~1.23x faster overall (about 19 fewer servers).
AI-written summary · about
chapters (15)
- 0:00Intro
- 1:00Welcome
- 1:55Backstory
- 7:40Performance Quiz
- 11:30Memory Profiler
- 12:30Code Triage
- 15:30Thank You Code
- 16:20Results
- 17:20Benchmarks
- 18:20Ttest
- 20:20Zoom in
- 21:00What does it even do
- 22:30Debugging
- 24:25Is it useful
- 26:00Conclusion
related talks
41mSpeed up Rails, Speed up Your Code
01h 15mSpeedupRails, Speedup Your Code
42m3x Rails: Tuning the Framework Internals
34mHow to optimize Ruby internal.
45mClosing Keynote: Analyzing and Reducing Ruby Memory Usage
33mFixing Performance & Memory problems
34mMetric Driven Development with Ruby on Rails
43mCat Care and Maintenance
