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 ITEMS = 1000;
const RW_COUNT = 1000;
const RW_COUNT_MINUS_1 = RW_COUNT - 1;
const smallDomObj = document.createElement('span');
smallDomObj.testValue = 0;
const bigDomObj = document.createElement('span');
bigDomObj.testValue = 0;
const items = [];
for (let i = 0; i<ITEMS; i++) {
items.push(`<span>${i}</span>`);
}
bigDomObj.innerHTML = items.join('');
bigDomObj.testValue = 0;
const smallPureObj = {};
smallPureObj.testValue = 0;
const bigPureObj = {};
for (let i = 0, items = []; i<ITEMS; i++) {
bigPureObj[`any_random_string_${i}`] = i;
}
bigPureObj.testValue = 0;
const smallArrayProp = [];
smallArrayProp.testValue = 0;
const bigArrayProp = new Array(ITEMS).fill(0);
bigArrayProp.testValue = 0;
const smallArrayIndex = [0];
const bigArrayIndexSameFirst = new Array(ITEMS).fill(0);
const bigArrayIndexSameLast = new Array(ITEMS).fill(0);
const bigArrayIndexInc = new Array(ITEMS).fill(0);
Ready to run.
Test | Ops/sec | |
---|---|---|
Inc small dom obj prop |
| ready |
Inc big dom obj prop |
| ready |
Inc small pure obj prop |
| ready |
Inc big pure obj prop |
| ready |
Inc small array prop |
| ready |
Inc big array prop |
| ready |
Inc small array index |
| ready |
Inc big array index (same first) |
| ready |
Inc big array index (same last) |
| ready |
Inc big array index (inc) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.