Dust if (linkedin fork)
JavaScript performance comparison
Info
Test foo bar "if" helper
Preparation code
<script src="http://gunta.org/experimental/dust/dust-full-1.0.0.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 tmpl4 = dust.compile('Hello {name}! You have {?count} {count} new messages {/count}', "tmpl4");
var tmpl3 = Hogan.compile('Hello {{name}}! You have {{count}} new messages.');
dust.loadSource(tmpl1);
dust.loadSource(tmpl2);
dust.loadSource(tmpl4);
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Dust render without if |
|
pending… |
Dust render with if |
|
pending… |
HoganJS |
|
pending… |
dust render with exists |
|
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:
- Revision 1: published by Tan Nhu
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published by Takeshi Miya
0 comments