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/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Map get
2.1M/s
Obj get
61K/s
Map set
55K/s
Obj set
53K/s
View exact numbers
Test name
Executions per second
✓
Map get
2,108,884 Ops/sec
Obj get
61,319 Ops/sec
Map set
54,812 Ops/sec
Obj set
53,057 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; });