Erubis, does it really make a difference?

9 views
Skip to first unread message

Josh Peek

unread,
Dec 10, 2007, 5:32:26 PM12/10/07
to Ruby on Rails: Core
Has anyone else done any benchmarks with Erubis? I've found it doesn't
make a big difference even without ActionPack template compiling. And
once its compiled to ruby code, it doesn't even matter, the results
are identical.

Can anyone else verify this?

I wiped up a clean Erubis helper that uses the new ActionView
TemplateHandlers, so make sure you're on edge and install the plugin
(http://svn.joshpeek.com/plugins/erubis/).

Jeremy Kemper

unread,
Dec 10, 2007, 5:54:10 PM12/10/07
to rubyonra...@googlegroups.com
On 12/10/07, Josh Peek <josh...@gmail.com> wrote:
> Has anyone else done any benchmarks with Erubis? I've found it doesn't
> make a big difference even without ActionPack template compiling. And
> once its compiled to ruby code, it doesn't even matter, the results
> are identical.
>
> Can anyone else verify this?

Yes, when I last tried I had similar results.

Accumulating the result in an Array instead of a String behaves better
with Ruby GC, but that's anecdotal (I didn't measure it).

jeremy

Nex3

unread,
Dec 11, 2007, 3:10:39 PM12/11/07
to Ruby on Rails: Core
The Haml codebase has a collection of benchmarks between various
templating engines, including Erubis and ERB, both with compiling and
without. Here's an example run: http://pastie.caboo.se/127100. We
don't test ERB vs. Erubis when running through ActionView, but the
results should be pretty much the same as when they're cached.

The upshot is that most of Erubis' speed is compilation speed; if the
results are cached, it's not nearly as dramatic. However, there's
still a ~15% speedup.

- Nathan

On Dec 10, 2:54 pm, "Jeremy Kemper" <jer...@bitsweat.net> wrote:
Reply all
Reply to author
Forward
0 new messages