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
const size = 100000;
const randomItems = []
const maxItems = []
const minItems = []
function buildArray() {
for (let i = 0; i < size; i++) {
randomItems.push({
someProp: Math.random(),
});
maxItems.push({
someProp: 1,
});
minItems.push({
someProp: 0,
});
}
}
buildArray();
function testEvery(items) {
return items.every(item => item.someProp >= 0.5);
}
function testNative(items) {
for (let i = 0; i < items.length; i++) {
if (!items[i].someProp >= 0.5) return false;
}
return true;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Array.prototype.every random items |
| ready |
Native for-loop random items |
| ready |
Array.prototype.every max items |
| ready |
Native for-loop max items |
| ready |
Array.prototype.every min items |
| ready |
Native for-loop min items |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.