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://code.jquery.com/jquery-git2.min.js"></script>
// Populate the base array
var arr = [];
for (var i = 0; i < 5000000; i++) {
arr[i] = (Math.random() * 1000 |0);
}
function someFn(ix) {
return ix ^ ix;
}
var len = arr.length, i = 0, arr2 = arr.slice();
i = 0; // reset counters if modified
arr = arr2.slice(); // repopulate by copying back
Ready to run.
Test | Ops/sec | |
---|---|---|
Order w/ array copy |
| ready |
While length-- |
| ready |
pop2 |
| ready |
non-init for |
| ready |
Object.keys |
| ready |
while non cached len |
| ready |
while obj.keys.length |
| ready |
jQuery |
| ready |
pop3 |
| ready |
shift 3 |
| ready |
noncached inline while |
| ready |
For loop, basic |
| ready |
While loop, basic |
| ready |
For loop, cached+init |
| ready |
For loop, i-- |
| ready |
Do-while loop, i-- |
| ready |
Do-while loop, --i |
| ready |
For..in loop |
| ready |
shift 1 |
| ready |
forEach |
| ready |
shift 2 |
| ready |
While ! Undefined |
| ready |
Pop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.