jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
This is a test for jQuery templating to see if update is anywhere faster than re-rendering.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script>
<script type="x-jquery-tmpl" id="tmplRow">
<tr>
<td>
{{if $data.DisplayFullName}}
${FullName}
{{else}}
${FirstName} ${LastName}
{{/if}}
</td>
</tr>
</script>
<script type="x-jquery-tmpl" id="tmplTbody">
<tbody>
{{each Rows}}
{{tmpl($value) '#tmplRow'}}
{{/each}}
</tbody>
</script>
<table id="table"></table>
<script>
$(function () {
var data = {
Rows: []
};
for (var i = 0; i < 100; i++) {
var row = {
FirstName: 'john',
LastName: 'doe',
FullName: 'This is a full name',
DisplayFullName: i % 2 == 0
}
data.Rows.push(row);
}
$('#tmplTbody').tmpl(data).appendTo('#table');
});
function updateData($tmpl) {
$tmpl.data.Rows[0].FirstName = "updated";
$tmpl.data.Rows[0].LastName = "updated";
$tmpl.data.Rows[0].FullName = "updated";
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Using Update() |
| ready |
Rebuild the whole thing |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.