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:
11 months ago
by:
Registered User
Jump 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:
11 months 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
Test name
Executions per second
Exec all
450986.7 Ops/sec
Match all
273494.7 Ops/sec
Match
1118675.5 Ops/sec
Related benchmarks:
test DomParser
tests-regex-for
test DomParser #2
jjasdasdasd
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?