Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
map vs obj xzdd
bench
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Browser:
Chrome 144
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
3 months ago
Test name
Executions per second
Using the spread operator
46.4 Ops/sec
Using Object.assign
110.1 Ops/sec
Script Preparation code:
const data = new Array(1000000) .fill(1) .map((item) => Math.floor(Math.random() * 10000))
Tests:
Using the spread operator
const map = new Map(); data.forEach((item) => { map.set(item, Math.random()); });
Using Object.assign
const map = {} data.forEach((item) => { map[item] = Math.random(); });