The View is Clear From Here
summary
Rails Action View templates compile into methods so the team measures compiled method sizes (≈1,200 bytes) and shows performance improvements: naive ERB renders ~27k/sec, caching the compiled source ~63k/sec, and turning templates into real methods hits 1.4 million renders/sec (≈52× faster). Caching partial-collection keys can backfire — a microbenchmark finds caching can be 5.6× slower than no-cache when key computation dominates. Practical fixes: forbid instance vars in views, pass view objects as locals, and use a same-format assumption to precompute fast, predictable render targets.
AI-written summary · about
chapters (30)
- 0:00Start
- 9:59ERB Template
- 10:21ERB Compiler
- 11:14Modified Compile Script
- 11:27Compiler Output
- 11:43ERB Translations
- 12:10Capturing Blocks
- 12:29What is the output?
- 12:40Compiled Source
- 14:09Different ERB Flavors
- 15:09Rendering Speed
- 15:28Cache Compilation
- 16:28Define a Method
- 17:21Method Generation
- 18:14Rails Template Methods
- 18:47Memory Size
- 19:44Instance Variable Visibility
- 24:25Too Many Compilations
- 27:11Users Controller Controller
- 27:36Template Source
- 28:22Template Cache Keys
- 29:18Template Contents
- 29:42Requests and Rendering
- 30:34respond_to Controller
- 31:09Context Dependent
- 34:37Three Templates
- 36:20Profiled The Cache
- 37:11Benchmark Results
- 37:55Same Format Assumption
- 38:43Ambiguous Render Problem
related talks
44m"The View Is Clear from Here"
42mRender It! A Deep Dive into ActionView and Template Engines
37mEncapsulating Views
58mPanel Discusion - Performance problems in Rails applications
38mRethinking the View Layer with Components
26mThe Ghosts of Action View Cache
59mClosing Keynote
34mCurly — Rethinking the View Layer
