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 camelCaseObject(obj) {
const result = {};
for (const key of Object.keys(obj)) {
const value = obj[key];
if (value && typeof value === 'object') {
result[_.camelCase(key)] = camelCaseObject(value);
} else {
result[_.camelCase(key)] = value;
}
}
return result;
}
const staff = [
{
"uuid": "694045019-25dfa7ea-6f5e-47e4-ae5c-9162236e1f2c",
"email": "nicholasroach@example.net",
"preferred_name": "Liz",
"role": "administrator",
"permissions": [
"user_can_manage_staff"
],
"has_staff_pin": true,
"staff_id": "1234",
"staff_number": "EMP2022",
"nested_example": {
"foo_bar": 42
}
}
];
// Make 10 copies of the staff member.
for (let i = 0; i < 10; ++i) {
staff.push(staff[0]);
}
const memoryDiffs = [];
let lastUsedJSHeapSize = performance.memory.usedJSHeapSize;
function measureMemory() {
const current = performance.memory.usedJSHeapSize;
memoryDiffs.push(current - lastUsedJSHeapSize);
lastUsedJSHeapSize = current;
}
console.log('MEMORY DIFF', memoryDiffs.reduce((t, n) => t + n, 0));
Ready to run.
Test | Ops/sec | |
---|---|---|
Identity |
| ready |
Lodash |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.