template engine comp
JavaScript performance comparison
Preparation code
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script>
Benchmark.prototype.setup = function() {
<script type="text/html" id='usageList'>
<table cellspacing='0' cellpadding='0' border='1' >
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<% _.each(items,function(item,key,list){ %>
<% var f = item.name; %><!-- create more variables -->
<tr>
<!-- use variables -->
<td><%= key %></td>
<td class="<%= f %>"><%= item.name %></td>
</tr>
<% }); %>
</tbody>
</table>
</script>
<!-- Create your target -->
<div id="target"></div>
<script type="text/javascript">
var items = [
{name:"Alexander"},
{name:"Barklay"},
{name:"Chester"},
{name:"Domingo"},
{name:"Edward"},
{name:"..."},
{name:"Yolando"},
{name:"Zachary"}
];
</script>
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
underscore |
|
pending… |
underscore with |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments