Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Excel content type using RegEx vs direct comparison
(version: 1)
Comparing performance of:
RegEx vs Direct comparison
Created:
5 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const regex = /sheet|excel|spreadsheet|officedocument/i function compare(mime) { return mime == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }
Tests:
RegEx
regex.test('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') regex.test('text/html')
Direct comparison
compare('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') compare('text/html')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
RegEx
Direct comparison
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Browser/OS:
Chrome 142 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
RegEx
6986259.0 Ops/sec
Direct comparison
55826100.0 Ops/sec
Related benchmarks:
RegexvsIndexOfvZ
Regex.test() vs str.match(regex) vs str.indexOf() with no matches
Case insensitive string comparison (moved prep code, undefined)
v2: .startsWith() vs .test() vs .match() vs .indexOf()
Javascript: Case insensitive string comparison
Case insensitive string comparison 2
javascript startsWith() vs regex for longer string
Test regex123123
startsWith or regex test or indexOf
Comments
Confirm delete:
Do you really want to delete benchmark?