Dust if

JavaScript performance comparison

Revision 3 of this test case created

Info

Test foo bar "if" helper

Preparation code

<script src="http://dl.dropbox.com/u/7677927/dust-full.js"></script>
<script src="http://dl.dropbox.com/u/7677927/dust-helpers.js"></script>
<script src="http://dl.dropbox.com/u/7677927/hogan-2.0.0.js"></script>

<script>
var data = {
  "name": "Mick",
  "count": 30
};

var tmpl1 = dust.compile('Hello {name}! You have {count} new messages.', "tmpl1");
var tmpl2 = dust.compile('Hello {name}! You have {@if cond="({count} > 0)"}{count} new messages.{/if}', "tmpl2");

var tmpl3 = Hogan.compile('Hello {{name}}! You have {{count}} new messages.');

dust.loadSource(tmpl1);
dust.loadSource(tmpl2);
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Dust render without if
dust.render("tmpl1", data, function(err, out) {
});
pending…
HoganJS
tmpl3.render(data);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment