Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map and Object number key vs string key
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/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Browser:
Chrome 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Integer
36.0 Ops/sec
Float
45.6 Ops/sec
String
56.2 Ops/sec
Integer with Object
43.0 Ops/sec
Float with Object
17.7 Ops/sec
String with Object
51.8 Ops/sec
Script Preparation code:
var map = new Map(); var obj = {}; var randomInteger = Array(100000).fill(0).map(v => Math.floor(Math.random() * 1e8)); var randomFloat = Array(100000).fill(0).map(v => Math.random() * 1e8); var randomString = Array(100000).fill(0).map(v => (Math.random() * 1e8).toString());
Tests:
Integer
map.clear(); randomInteger.forEach(v => { map.set(v, Math.random()); map.get(v); });
Float
map.clear(); randomFloat.forEach(v => { map.set(v, v); map.get(v); });
String
map.clear(); randomString.forEach(v => { map.set(v, v); map.get(v); });
Integer with Object
obj = {}; randomInteger.forEach(v => { obj[v] = v; obj[v]; });
Float with Object
obj = {}; randomFloat.forEach(v => { obj[v] = v; obj[v]; });
String with Object
obj = {}; randomString.forEach(v => { obj[v] = v; obj[v]; });