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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://s3.amazonaws.com/s3.alfajango.com/jsperf/dynatable-refactor/jquery.dynatable-0.0.3.js"></script>
<script src="https://s3.amazonaws.com/s3.alfajango.com/jsperf/dynatable-refactor/jquery.dynatable-0.1.0.js"></script>
<script src="https://s3.amazonaws.com/s3.alfajango.com/jsperf/dynatable-refactor/jquery.dynatable.js"></script>
<script src="https://s3.amazonaws.com/s3.alfajango.com/jsperf/dynatable-refactor/jquery.dynatable-0.2.0.js"></script>
<div id="container"></div>
var numTables = 20,
numColumns = 5,
numRows = 50,
tables = [];
function randomString(length) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
result = '';
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
return result;
}
for (var t = 0; t < numTables; t++) {
var thisNumRows = numRows,
thisNumColumns = numColumns,
rows = [], columns = [],
className = 'test-table';
className += t % 2 ? ' even' : ' odd';
if (t === 0) {
className += ' large-row-set';
thisNumRows = 2000;
} else if (t === 1) {
className += ' large-col-set';
thisNumColumns = 100;
} else {
className += ' normal-set';
}
for (var i = 0; i < thisNumColumns; i++) {
columns.push('<th>Column ' + i + '</th>');
}
for (var i = 0; i < thisNumRows; i++) {
var data = [];
for (var n = 0; n < numColumns; n++) {
data.push(randomString(16));
}
rows.push('<tr><td>' + data.join('</td><td>') + '</td></tr>');
}
tables.push('<table id="test-table-' + t + '" class="' + className + '"><thead><tr>' + columns.join() + '</tr><tbody>' + rows.join() + '</tbody></table>');
}
$('#container').html(tables.join());
var normalSet = $('.normal-set'),
largeRowSet = $('.large-row-set'),
largeColSet = $('.large-col-set'),
emptySet = $('.does-not-exist'),
enterKey = $.Event( "keypress", { which: 13 } );
$('.test-table').remove();
$('#container').html('');
Ready to run.
Test | Ops/sec | |
---|---|---|
Init Lots of Tables - Old |
| ready |
Init Lots of Tables - Refactored |
| ready |
Init Lots of Tables - Refactored for loop |
| ready |
Init Lots of Tables - Refactored string concat rows |
| ready |
Init Lots of Rows - Old |
| ready |
Init Lots of Rows - Refactored |
| ready |
Init Lots of Rows - Refactored for loop |
| ready |
Init Lots of Rows - Refactored string concat rows |
| ready |
Init Lots of Columns - Old |
| ready |
Init Lots of Columns - Refactored |
| ready |
Init Lots of Columns - Refactored for loop |
| ready |
Init Lots of Columns - Refactored string concat rows |
| ready |
Sort - Old |
| ready |
Sort - Refactored |
| ready |
Sort - Refactored for loop |
| ready |
Sort - Refactored string concat rows |
| ready |
Search - Old |
| ready |
Search - Refactored |
| ready |
Search - Refactored for loop |
| ready |
Search - Refactored string concat rows |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.