Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS > exec all vs matchAll vs match
(version: 2)
Comparing performance of:
Exec all vs Match all vs Match
Created:
one year ago
by:
Registered User
Go to the latest result
Tests:
Exec all
const TAG_REGEX = /(\w+)/g; const dirtyHtml = 'aqui é uma <strong class="elm">questão</strong> de teste <img class="elm" onerror="opa"></img><br class="elm"/><iframe src="http://" class="iframeclass"/><iframe src="http://" class="iframeclass"/><iframe src="http://" class="iframeclass"/>'; let match; while ((match = TAG_REGEX.exec(dirtyHtml)) !== null) { // console.log(match); // Process each match }
Match all
const TAG_REGEX = /(\w+)/g; const dirtyHtml = 'aqui é uma <strong class="elm">questão</strong> de teste <img class="elm" onerror="opa"></img><br class="elm"/><iframe src="http://" class="iframeclass"/><iframe src="http://" class="iframeclass"/><iframe src="http://" class="iframeclass"/>'; [...dirtyHtml.matchAll(TAG_REGEX)]
Match
const TAG_REGEX = /(\w+)/g; const dirtyHtml = 'aqui é uma <strong class="elm">questão</strong> de teste <img class="elm" onerror="opa"></img><br class="elm"/><iframe src="http://" class="iframeclass"/><iframe src="http://" class="iframeclass"/><iframe src="http://" class="iframeclass"/>'; dirtyHtml.match(TAG_REGEX)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Exec all
Match all
Match
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Match
1.1M/s
Exec all
451K/s
Match all
273K/s
View exact numbers
Test name
Executions per second
✓
Match
1,118,676 Ops/sec
Exec all
450,987 Ops/sec
Match all
273,495 Ops/sec
Related benchmarks
test DomParser
test DomParser #2
JS > exec vs matchAll vs match
URL parsing and matching
test DomParser vs Regex vs IndexIf
Regex Memory Consumption
A Spl vs Regx
Comments
Confirm delete:
Do you really want to delete benchmark?