SMRTR ProgrammingSep 9, 2025Lobsters

How I Made Ruby Faster than Ruby

SMRTR summary

P2, a Ruby HTML templating library, transforms templates into optimized code that's never actually executed. Through key improvements to the code generation process—separating static and dynamic HTML, removing rescue clauses, freezing string literals, and using faster HTML escaping—P2 now matches ERB/ERubi performance while being 10x faster than non-compiled alternatives like Papercraft. This compilation approach demonstrates that Ruby can be extremely fast when code is properly optimized.

SMRTR provides this summary for quick context. The original article belongs to Lobsters.

Read the original article
SMRTR Programming

Get the next batch of curated summaries in your inbox.

This archive is built from SMRTR newsletter summaries. Subscribe for hand-picked stories without the extra noise.