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 aims to compare different methods to clone a nodelist into an array (comparable to array-clone).
Note: Some browser cannot use nodelist as apply arguments, others as issue keeping reference to live nodelist...
<div id='testdiv'></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());
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
slice.call |
| ready |
slice.apply |
| ready |
push.apply |
| ready |
unshift.apply |
| ready |
Optimum increasing loop |
| ready |
Optimum decreasing loop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.