Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test vs Array
(version: 1)
Comparing performance of:
Regex vs Array
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const a = "/shorts/C0DLmWfdLGQ"; function isVideoPageR(type) { const types = new RegExp("/" + (type || "(watch|short)")); return types.test(a); } function isVideoPage(type) { const types = type ? [type] : ["watch", "short"]; return types.some((type) => a.startsWith("/" + type)); }
Tests:
Regex
isVideoPageR()
Array
isVideoPage()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Regex
Array
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser/OS:
Firefox 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Regex
7998343.0 Ops/sec
Array
18085652.0 Ops/sec
Related benchmarks:
String.match 2
String.match 4
Re-usable regex
regex v split
startsWith or regex test
startsWith or regex test or indexOf
String.includes vs Regex.test
A Spl vs Regx
Test regexp vs startsWith
Comments
Confirm delete:
Do you really want to delete benchmark?