Erubis, does it really make a difference?

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 (

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).


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: Parked at Loopia. 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