in Rails

Optimizing Rails template helper methods

Stefan Kaes is at it again with some interesting code to optimize Rails template helper methods. I have always wondered about some of the helper methods e.g. “< %= end_form_tag %>“. Why would you need that when it is easier to write “”?

Anyway, Stefan has shown that there is a cost to using many of the helper methods and that optimizing them may give you a performance increase. Methods involving routes are the worst performers.

By evaluating many of the methods only once (at template compile time) performance is increased. To see how your Rails application can be improved have a look at “Rails Template Optimizer Beta Test“.