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
Test name
Executions per second
set has
178133536.0 Ops/sec
regex
38136244.0 Ops/sec
in check
166323776.0 Ops/sec
hasOwnProperty
6959219.5 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')