Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set has vs object key - small object
performance comparison of looking up a value from a set
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Set.has
107.6M/s
Object[key]
97.6M/s
Includes
29.2M/s
View exact numbers
Test name
Executions per second
✓
Set.has
107,596,240 Ops/sec
Object[key]
97,597,504 Ops/sec
Includes
29,191,880 Ops/sec
Script Preparation code:
var obj = { '.': true, ' ': true, ',': true, ';': true, }; var array = Object.keys(obj); var set = new Set(array);
Tests:
Includes
array.includes(',') && array.includes('/')
Object[key]
obj[','] && obj['/']
Set.has
set.has(',') && set.has('/')