Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
test Map vs Object with string which use string as key and value
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/130.0.0.0 Safari/537.36 Edg/130.0.0.0
Browser:
Chrome 130
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Map get
282K/s
Obj get
82K/s
Obj set
69K/s
Map set
47K/s
View exact numbers
Test name
Executions per second
✓
Map get
281,960 Ops/sec
Obj get
82,335 Ops/sec
Obj set
68,567 Ops/sec
Map set
46,791 Ops/sec
Script Preparation code:
const map = new Map(); const obj = {}; function generateKeys(startIndex, endIndex) { const res = []; for (let i = startIndex; i < endIndex; i++) { res.push(btoa(i)); } return res; } const kvs = generateKeys(0, 1000); const newKvs = generateKeys(10000, 12000); kvs.forEach(kv => { map.set(kv, kv); obj[kv] = kv; });
Tests:
Map get
kvs.forEach(kv => { map.get(kv); });
Obj get
kvs.forEach(kv => { obj[kv]; });
Map set
kvs.forEach(kv => { map.set(kv, kv); });
Obj set
kvs.forEach(kv => { obj[kv] = kv; });