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
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
function shuffleDigits(number) {
let digits = shuffleArray(number.toString().split(''));
return parseInt(digits.join(''));
}
const size = 1000;
const groupSize = 100;
const MAX_NUMBER = 1e4;
let input = [];
for (let i = 10000; i < 10000 + size; i += 1) {
const num = Math.floor(Math.random() * MAX_NUMBER);
for (let j = 0; j < groupSize; j += 1) {
input.push(shuffleDigits(num));
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
array |
| ready |
array - no key resize |
| ready |
array - no key resize & key join |
| ready |
sort |
| ready |
sort - dummy zero remove |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.