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
These tests compare different methods to clone a nodelist into an array (comparable to array-clone).
Note: Some browser cannot use nodelist as apply arguments
<div id='testdiv'>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</div>
<script>
var div = document.getElementById('testdiv'),
span = document.createElement('span'),
slice = Array.prototype.slice,
push = Array.prototype.push,
unshift = Array.prototype.unshift,
array, i, l, n, childs;
for (var i = 0; i < 100; i++) {
div.appendChild(span.cloneNode(false)); // Add false/ true, or cloneNode will fail silently in FF
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
slice.call |
| ready |
slice.apply |
| ready |
push.apply |
| ready |
unshift.apply |
| ready |
Optimum decreasing loop |
| ready |
Optimum increasing loop |
| ready |
__proto__ change |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.