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
Testing the speed of iterating various sized arrays with straight for-loop or with a for-in-loop over its keys.
<script>
// setup `arr3` array ('big')
var arr3 = [];
for (var m = 0; m < 5000; m++) {
arr3.push(Math.round(Math.random()));
}
// seed `arr3_keys` hash
var arr3_keys = {};
for (m = 0; m < arr3.length; m++) {
arr3.hasOwnProperty(m) && (arr3_keys[m] = 0);
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
for-loop |
| ready |
for-in-loop on keys |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.