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 may still work in IE a couple of hundred elements (though very slowly), but when raising the amount of elements to around ~500, you'll probably already get the "Stop running script" alert.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>var a = jQuery.noConflict();</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script>var b = jQuery.noConflict();</script>
<style>
input, select, ul, div {
display: none;
}
</style>
<div class="lonely">
</div>
<div id="items">
</div>
<script>
var amt = 50;
var $n;
var $a_items = a('#items'),
$b_items = b('#items');
var elems = [];
for (var i = 0; i < amt; i++) {
elems.push('<ul><li>foo</li></ul>');
elems.push('<div>hmm</div>');
elems.push('<input type="hidden" name="hoo' + i + '" /> ')
elems.push('<select><option value="1">foo</option></select>')
}
$a_items.html(elems.join(""));
$b_items.html(elems.join(""));
// was test 1, eliminating cause it's pretty fast
$a_items.find('input');
$b_items.find('input');
// test 2: see prev note
$a_items.find('li');
$b_items.find('li');
// test 3:
$a_items.find('li').add('.lonely');
$b_items.find('li').add('.lonely');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
1.4.2 operation |
| ready |
1.5.2 operation |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.