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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Integer
72.3 Ops/sec
Float
49.0 Ops/sec
String
72.8 Ops/sec
Integer with Object
39.9 Ops/sec
Float with Object
11.3 Ops/sec
String with Object
51.5 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]; });