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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
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
120626640.0 Ops/sec
Get symbol key from map with mixed string and symbol keys
58534216.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);