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
<style type="text/css">
#canvas {
position:absolute;
left: -1000px;
}
</style>
<div id="css"></div>
<div id="canvas"></div>
function makeHtml(rows) {
var html = '<div class=".extra"></div><a class="a"><div class="b"><div class="c"><div class="d"><div class="e rows">';
for (var i = 0; i < rows; i++) {
html += '<div class="row"><div></div><div></div><div class="r0"><div class="r1"><div class="r2"><div class="r3" id="r3"><div class="r4">' +
'test</div></div></div></div></div></div>';
}
html += '</div></div></div></div></div>';
return html;
}
document.getElementById('canvas').innerHTML = '';
document.getElementById('css').innerHTML = '';
function run(rows, css) {
var canvas = document.getElementById('canvas');
var style = document.getElementById('css');
var ss1 = document.createElement('style');
var def = 'body {color: red;}';
ss1.setAttribute("type", "text/css");
var hh1 = document.getElementsByTagName('head')[0];
hh1.appendChild(ss1);
if (ss1.styleSheet) { // IE
ss1.styleSheet.cssText = css;
} else { // the world
var tt1 = document.createTextNode(css);
ss1.appendChild(tt1);
}
style.innerHTML = '';
style.appendChild(ss1);
canvas.innerHTML = makeHtml(rows);
// Convince browser to recalc style
canvas.className = 'foo' + Math.random();
var height = canvas.offsetHeight + document.body.offsetHeight;
}
run(0, '#canvas * { font-size: 2px; height: 20px; }');
Ready to run.
Test | Ops/sec | |
---|---|---|
a couple descendent selectors |
| ready |
a lot of child selectors |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.