The Anatomy of an ERB Rendering Engine
summary
ERB is a tiny compiler that turns templates into Ruby source; classic engines like erb and erubi scan and emit fast string-appends. A syntax-tree approach with Herb::Engine parses HTML and Ruby (uses Prism), trading ~21 µs vs 424 µs compile time (≈20× slower compile) for identical ~1.14 µs render speed and new capabilities: precise diagnostics, a registry of ~250 Rails helpers enabling static evaluation (3–100× faster on helper-heavy fragments), live partial updates in the dev server, and groundwork for fine-grained reactivity.
AI-written summary · about
chapters (13)
- 0:00ERB rendering engines intro
- 2:57ERB as Ruby generator
- 7:36ERB engine anatomy
- 11:47String-splitting ERB limits
- 13:12Herb parsing approach
- 16:44Compile time vs ERB
- 18:54Runtime performance
- 20:21Optimization domain
- 23:49Diagnostics and tooling
- 25:37Live reloading with Herb
- 26:42Reactive Action View vision
- 28:48ERB vs Herb engines
- 30:13Template engines future
related talks
32mHTML-Aware ERB: The Path to Reactive Rendering
30mHerb to ReActionView
27mA Quest for the Ultimate Template Engine
47mTemplate Engines in Ruby
29mRuby Internals: A Guide For Rails Developers
47mBERT and Ernie: Scaling your Ruby site with Erlang
37mKeynote: Herb to ReActionView: A New Foundation for the View Layer
06mLightning Talk – Chris Hagmann
