Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
es6 map access with string vs symbol keys.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 137
Operating system:
Android
Device Platform:
Mobile
Date tested:
11 months ago
Test name
Executions per second
Get string key from map with only string keys
125022592.0 Ops/sec
Get symbol key from map with mixed string and symbol keys
118942808.0 Ops/sec
Script Preparation code:
var mapStringKeys = new Map([["one", true], ["two", true], ["three", true], ["four", true], ["five", true], ["six", true], ["seven", true], ["eight", true], ["nine", true], ["ten", true]]); var mapStringAndSymbolKeys = new Map([["one", true], [Symbol("two"), true], ["three", true], [Symbol("four"), true], ["five", true], [Symbol("six"), true], ["seven", true], [Symbol("eight"), true], ["nine", true], [Symbol("ten"), true]]); var eightSymbol = Symbol("eight")
Tests:
Get string key from map with only string keys
var value = mapStringKeys.get('eight');
Get symbol key from map with mixed string and symbol keys
var value = mapStringAndSymbolKeys.get(eightSymbol);