Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object mapping
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Object.fromEntries
237.1 Ops/sec
Reduce (reuse object)
2927.1 Ops/sec
R.mapObjIndexed
5690.0 Ops/sec
HTML Preparation code:
<script src="//cdn.jsdelivr.net/npm/ramda@latest/dist/ramda.min.js"></script>
Script Preparation code:
var data = { ...Array.from(Array(10000).keys()) };
Tests:
Object.fromEntries
const x = Object.fromEntries(Object.entries(data).map((key, value) => [key, value*2])); console.log(x)
Reduce (reuse object)
const x = Object.entries(data).reduce((acc, [k, v]) => { acc[k] = v*2 return acc; }, {}); console.log(x)
R.mapObjIndexed
const x = R.mapObjIndexed((value, key) => value * 2, data) console.log(x)