Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
DTMF: array includes vs regex
compares the performance between array includes vs regex
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/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Regex
6765076.5 Ops/sec
Array includes
6553526.5 Ops/sec
Script Preparation code:
var dtmfTone = "9"; var regex = /^[0-9A-D#*]+$/; var arr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "#", "*"];
Tests:
Regex
regex.test(dtmfTone);
Array includes
arr.includes(dtmfTone);