Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
test DomParser #2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0
Browser:
Chrome 119
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Regex2
15.6M/s
Regex3
13.8M/s
Regex
6.4M/s
Dom Parser
15K/s
View exact numbers
Test name
Executions per second
✓
Regex2
15,648,218 Ops/sec
Regex3
13,844,575 Ops/sec
Regex
6,369,288 Ops/sec
Dom Parser
15,137 Ops/sec
Tests:
Dom Parser
const html = "<html><body><div>test</div></body></html>" const parser = new DOMParser(); const virtualDom = parser.parseFromString(html, 'text/html'); const body = virtualDom.querySelector('body');
Regex
const html = "<html><body><div>test</div></body></html>" const pattern = /<body[^>]*>((.|[\n\r])*)<\/body>/im; const matches = pattern.exec(html); const body = matches[1]
Regex2
const html = "<html><body><div>test</div></body></html>" const pattern = /<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g; const matches = pattern.exec(html); const body = matches[1]
Regex3
const html = "<html><body><div>test</div></body></html>" const pattern = /<(.|\n)+?>/g; const matches = pattern.exec(html); const body = matches[1]