paularmstrong/node-templates — Issue #6: Compile benchmarks a little misleading
Author: gsf
Created: 2011-11-24 10:06:47+00:00
State: open

As I was adding the Whiskers library I was a little surprised by the big gap between Swig and most other engines in the compile bench. In that step, Swig is calling the "fromString" method, which uses a cache if I'm not mistaken. This is a bit of an unfair comparison, since most of the other engines are actually compiling the template each time, not just grabbing it from a cache (not surprisingly, it looks like the other "fast" compiler, jqtpl, is also caching).

I tend to think of the render method as the proper place for caching, whereas I see compile as lower level. See how the two relate in the Whiskers code at https://github.com/gsf/whiskers.js/blob/master/lib/whiskers.js. Whether you agree with that philosophy or not, I still think the compile bench would be more interesting if it actually compared the compile speeds of the various template engines, and not just if they cache or not at that stage.

Lastly, I agree that any benchmarks in the realm of templating should be taken lightly. Thanks for the nice-looking comparison of node templates that you created, and for encouraging contributions.