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 type | Etanni faster than ERb by |
|---|---|
| Just HTML (no templating) | 38.3% |
| In-template loop with expression interpolation | 20.7% |
| Ruby expression evaluation | 43.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.
Related posts:
When it comes to templating I care first about syntax and second about speed. HAML destroys all. No further comments. lol