Writing fast Ruby
summary
Shows concrete, measurable wins: use Benchmark IPS to compare changes, yielding beats explicit proc calls — 5x faster in a real production patch — flat_map replaces map+flatten for ~4.5x speedup, replace gsub with sub when only one occurrence for ~50% savings, fetch with block avoids allocating defaults (~2x), prefer while loops over each_with_index (~80% faster) in hot paths, prefer bang mutations and direct assignments to avoid allocations, and a pull request to Rails currently lands many of these fixes.
AI-written summary · about
chapters (4)
- 0:00Introduction to optimization
- 1:31Practical code examples
- 34:03Future of Ruby performance
- 37:15Q&A and conclusion








