Ramaze vs. Rails: Battle of the default templating engines

June 2, 2009 at 11:14

Filed under: Computing — Pistos @ 11:14

Someone asked recently on the Ramaze mailing list:

Is Etanni a performance improvement over ERB? I’m just converting a site over to Ramaze and I’m wondering if it’d be worthwhile to convert my ERB tags to Etanni tags? :)

manveru promptly replied:

ERB is a lot larger, and does a lot more, but usually you don’t use that functionality. Etanni consists of a single regular expression substitution and should be faster than just about any other templating engine around, the whole core source of Etanni is around 4 lines.

So yes, i suggest you use Etanni instead of ERB :)

He also quickly wrote up some benchmarking code to substantiate his claims, and then enlisted me to solidify matters. I used his code as a base, and ran the same engine test code through better-benchmark. I put the benchmarking code up as a gist. The full results are embedded as a comment at the end of the gist. Here is a summary:

Template typeEtanni faster
than ERb by
Just HTML (no templating)38.3%
In-template loop with expression interpolation20.7%
Ruby expression evaluation43.9%

Based on the results of this little test we might conclude: If rendering speed is a concern, but you also want to just stick with your framework’s default engine to minimize gem dependencies, go with Ramaze. :)

  • Share/Bookmark

No related posts.

1 Comment »

RSS feed for comments on this post. TrackBack URI

Leave a comment

You may use Markdown syntax in your comment.

Powered by WP Hashcash

Powered by WordPress.