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
Object[key]
100.4M/s
Set.has
96.1M/s
Includes
28.8M/s
View exact numbers
Test name
Executions per second
✓
Object[key]
100,397,456 Ops/sec
Set.has
96,093,880 Ops/sec
Includes
28,828,824 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('/')