August 15, 2006

Posted by John

Tagged optimization, templates, and views

Older: Active Record Dynamic Finders

Newer: memcached Intro

Stefan Kaes Template Optimizer

Stefan of RailsExpress has just released his new template optimizer (trac available here). The data set that he shows at the end of the post look pretty impressive. I can’t wait to try this. So how does it work? Glad you asked.

Whenever the code for a Rails template gets compiled, the Rails Template Optimizer gets invoked in the context of the current controller’s view class, with the name of the compiled render method. It then retrieves the abstract syntax tree of the render method, processes it according to a set of configured optimization options, creates Ruby source code from the transformed tree and evaluates the new source to obtain an optimized version of the original method.


Thoughts? Do Tell...

textile enabled, preview above, please be nice
use <pre><code class="ruby"></code></pre> for code blocks


Authored by John Nunemaker (Noo-neh-maker), a programmer who has fallen deeply in love with Ruby. Learn More.


Release your software more often with fewer problems.
Flip your features.