Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.fromEntries + Object.entries vs Object.keys
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Object.fromEntries + Object.entries
1478251.9 Ops/sec
Object.keys
1423033.1 Ops/sec
Script Preparation code:
var obj = {v1: {value: 'string', num: 123, obj: {boo: true, arr: [{str: 'string'},{str: 'string'},{str: 'string'},{str: 'string'},{str: 'string'}]}}, v2: {value: 'string', num: 123, obj: {boo: true, arr: [{str: 'string'},{str: 'string'},{str: 'string'},{str: 'string'},{str: 'string'}]}}}
Tests:
Object.fromEntries + Object.entries
JSON.stringify(Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, {...value, obj: value.obj.arr}])))
Object.keys
const newObj = {} Object.keys(obj).forEach(key => { newObj[key] = { ...obj[key], ccSubset: obj[key]?.ccSubset?.ccSubset }; }); JSON.stringify(newObj)