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 obj = {
_id: '5bede99c0e1d33c83e6268c8',
index: 0,
guid: '0fb8cedb-2d45-4d6f-8ddb-6c8680588235',
isActive: true,
balance: '$3,822.80',
picture: 'http://placehold.it/32x32',
age: 26,
eyeColor: 'blue',
name: {
first: 'Sally',
last: 'Drake',
},
company: 'SECURIA',
email: 'sally.drake@securia.net',
phone: '+1 (870) 428-3009',
address: '219 Rutledge Street, Barronett, Utah, 2541',
about:
'Nisi labore nostrud esse aliqua voluptate ipsum magna quis eu incididunt nulla cupidatat. Magna nisi et sint excepteur magna ea velit adipisicing culpa. Exercitation cupidatat do sunt sit eiusmod veniam exercitation. Ea sit voluptate adipisicing excepteur amet cillum aliquip amet. Et esse voluptate labore laborum ex velit eiusmod culpa enim amet ut eu excepteur commodo. Aliquip enim deserunt labore ad non mollit ullamco nulla id laboris qui est.',
registered: 'Monday, August 10, 2015 12:25 PM',
latitude: '-81.164075',
longitude: '79.493894',
tags: ['aliqua', 'ad', 'enim', 'excepteur', 'ex'],
range: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
friends: [
{
id: 0,
name: 'Levy Brooks',
},
{
id: 1,
name: 'Joann Snider',
},
{
id: 2,
name: 'Peters Miles',
},
],
greeting: 'Hello, Sally! You have 6 unread messages.',
favoriteFruit: 'apple',
}
function deepObject(source) {
const result = {}
Object.keys(source).forEach((key) => {
const value = source[key]
result[key] = deep1(value)
}, {})
return result
}
function deepArray(collection) {
return collection.map((value) => {
return deep1(value)
})
}
function deep1(value) {
if (typeof value !== 'object' || value === null) {
return value
}
if (Array.isArray(value)) {
return deepArray(value)
}
return deepObject(value)
}
function deep2(source) {
return JSON.parse(JSON.stringify(source))
}
Ready to run.
Test | Ops/sec | |
---|---|---|
v1 |
| ready |
v2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.