Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Logs - RegEx.test vs. String.includes vs. String.match
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/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
regex
21249698.0 Ops/sec
includes
187129792.0 Ops/sec
match
8391051.0 Ops/sec
Script Preparation code:
const regex = /TF_LOG|(?:Creating|Modifying|Destroying)\.\.\./; const string = "module.helm_agent.helm_release.agent: Still modifying... [id=agent-bors, 10s elapsed]";
Tests:
match
function isRelevantLogEntryStrMatch(logEntry) { return ( logEntry.match('TF_LOG') || logEntry.match('Creating...') || logEntry.match('Modifying...') || logEntry.match('Destroying...') ); } isRelevantLogEntryStrMatch(string);
includes
function isRelevantLogEntryIncludes(logEntry) { return ( logEntry.includes('TF_LOG') || logEntry.includes('Creating...') || logEntry.includes('Modifying...') || logEntry.includes('Destroying...') ); } isRelevantLogEntryIncludes(string);
regex
function isRelevantLogEntryRegex(logEntry) { return regex.test(logEntry); } isRelevantLogEntryRegex(string);