Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
set has vs regex
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/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
set has
178.1M/s
in check
166.3M/s
regex
38.1M/s
hasOwnProperty
7.0M/s
View exact numbers
Test name
Executions per second
✓
set has
178,133,536 Ops/sec
in check
166,323,776 Ops/sec
regex
38,136,244 Ops/sec
hasOwnProperty
6,959,220 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let str = `qwertyuiopasdfghjklzxcvbnm`.split('') let set = new Set(str) let regex = RegExp(str.join('|')) let obj = Object.fromEntries(str.map(o=>[str,str])) let hop = hasOwnProperty.bind(obj)
Tests:
set has
set.has('1') set.has('m')
regex
regex.test('1') regex.test('m')
in check
1 in obj 'm'in obj
hasOwnProperty
hop(obj, 1) hop(obj, 'm')