Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
RegExp Case Sensitivity
(version: 0)
Comparing performance of:
Insensitive vs Sensitive vs Empty
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
listPathExclusionsA = [ // Static JS components and scripts /^\/advancedsetup\/(jsbundles|ckeditor)\/.+\.js$/i, // Not a static asset per se, but we don't parse the integ event or // search for it in the logs, and it can as much as 20% of our CE event // volume (across all integrations) during peak CE activity. This is // loaded each time the schedule window is opened. /^\/aspx\/appointments\/appttrial\.aspx$/i, // Additional events that we do not parse but each constitute // 0.6-1.5% of data volume so we might as well not waste customer, // logging, and NexHealth API bandwidth on these. /^\/advancedsetup\/progressnotes\/index$/i, /^\/advancedsetup\/patientdetail\/getpatinetheaderdetailsv3$/i, /^\/aspx\/patients\/advancednotes\.aspx$/i, /^\/aspx\/home\/advancedsearchpatients\.aspx$/i, /^\/aspx\/appointments\/quickschedule\.aspx$/i, /^\/aspx\/transactions\/advancedtreatplanquickentry\.aspx$/i, /^\/aspx\/charting\/advancedcharting\.aspx$/i, /^\/aspx\/charting\/restchart2\.aspx$/i, // The following are small yet frequent requests that we do not // need or parse. /^\/ASPX\/Appointments\/timer\.html$/i, /^\/ASPX\/GetProviderOperatories\.aspx$/i, /^\/ASPX\/xhr\.aspx$/i, // Used to look up CDN URLs for static assets /^\/token\/getToken$/i, /^\/ASPX\/Reports\/GetOfficeHippaLetters\.aspx$/i, /^\/ASPX\/Appointments\/GetProdValues\.aspx$/i, /^\/ASPX\/Home\/SetTicklerCounter\.aspx$/i, ]; listPathExclusionsB = []; listPathExclusionsC = [ // Static JS components and scripts /^\/advancedsetup\/(jsbundles|ckeditor)\/.+\.js$/, // Not a static asset per se, but we don't parse the integ event or // search for it in the logs, and it can as much as 20% of our CE event // volume (across all integrations) during peak CE activity. This is // loaded each time the schedule window is opened. /^\/aspx\/appointments\/appttrial\.aspx$/, // Additional events that we do not parse but each constitute // 0.6-1.5% of data volume so we might as well not waste customer, // logging, and NexHealth API bandwidth on these. /^\/advancedsetup\/progressnotes\/index$/, /^\/advancedsetup\/patientdetail\/getpatinetheaderdetailsv3$/, /^\/aspx\/patients\/advancednotes\.aspx$/, /^\/aspx\/home\/advancedsearchpatients\.aspx$/, /^\/aspx\/appointments\/quickschedule\.aspx$/, /^\/aspx\/transactions\/advancedtreatplanquickentry\.aspx$/, /^\/aspx\/charting\/advancedcharting\.aspx$/, /^\/aspx\/charting\/restchart2\.aspx$/, // The following are small yet frequent requests that we do not // need or parse. /^\/ASPX\/Appointments\/timer\.html$/, /^\/ASPX\/GetProviderOperatories\.aspx$/, /^\/ASPX\/xhr\.aspx$/, // Used to look up CDN URLs for static assets /^\/token\/getToken$/, /^\/ASPX\/Reports\/GetOfficeHippaLetters\.aspx$/, /^\/ASPX\/Appointments\/GetProdValues\.aspx$/, /^\/ASPX\/Home\/SetTicklerCounter\.aspx$/, ]; function findResource(path, listPathExclusions) { for (const exclusion of listPathExclusions) { if (exclusion.test(path)) { return true; } } return false; };
Tests:
Insensitive
findResource('/aspx/cats/dogs', listPathExclusionsA);
Sensitive
findResource('/aspx/cats/dogs', listPathExclusionsC);
Empty
findResource('/aspx/cats/dogs', listPathExclusionsB);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Insensitive
Sensitive
Empty
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser/OS:
Chrome 120 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Insensitive
4118761.0 Ops/sec
Sensitive
4008789.5 Ops/sec
Empty
12178244.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's dive into the Benchmark Definition JSON and explain what is tested. **Benchmark Name:** RegExp Case Sensitivity **Description:** This benchmark tests the performance of the `findResource` function, which checks if a given URL path matches any of the excluded paths in two lists (`listPathExclusionsA` and `listPathExclusionsC`). **Options being compared:** 1. **Case-sensitive search (listPathExclusionsA)**: This option uses the `/i` flag at the end of each regular expression to make them case-insensitive. 2. **Case-sensitive search (listPathExclusionsC)**: Similar to listPathExclusionsA, but without the `/i` flag, making them case-sensitive. 3. **Empty list (listPathExclusionsB)**: This option uses an empty array as the second argument to `findResource`, effectively disabling any path matching. **Pros and Cons of each approach:** 1. Case-sensitive search: * Pros: Can be faster for certain use cases, especially when exact matches are required. * Cons: May not perform well for case-insensitive searches or when dealing with URLs that contain multiple characters (e.g., "Hello World"). 2. Case-insensitive search: * Pros: Easier to match URLs with different cases, but may be slower due to the flag's overhead. * Cons: May lead to false positives if the regular expression patterns are not carefully crafted. 3. Empty list: * Pros: Can significantly reduce the number of path matching operations, potentially leading to faster performance. * Cons: Will only match paths that do not exist in either list, which may be undesirable. **Implementation details:** The `findResource` function iterates through each exclusion in the provided list and checks if the input URL path matches using the `test()` method. If a match is found, it returns `true`. If no match is found after iterating through all exclusions, it returns `false`. In the context of this benchmark, we're concerned with the performance difference between these three approaches. **Benchmark results:** The latest benchmark results show the executions per second (ExecutionsPerSecond) for each test case: * "Empty" (listPathExclusionsB): 12178244.0 * "Insensitive" (listPathExclusionsA): 4118761.0 * "Sensitive" (listPathExclusionsC): 4008789.5 The results suggest that using an empty list (`listPathExclusionsB`) leads to the highest performance, followed closely by the case-insensitive search option (`listPathExclusionsA`). The case-sensitive search option (`listPathExclusionsC`) performs worst. Keep in mind that these results may vary depending on the specific use case and requirements.
Related benchmarks:
regex vs compiled regex vs includes
regex.test v includes
regex vs includ
RegEx.test vs. String.includes vs. String.match __ 1
Comments
Confirm delete:
Do you really want to delete benchmark?