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 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser:
Firefox 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Get string key from map with only string keys
1395747328.0 Ops/sec
Get symbol key from map with mixed string and symbol keys
1502628096.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);