Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
querySelectorAll(*) vs getElementsByTagName(*) iteration
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/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
querySelectorAll
170740.1 Ops/sec
getElementsByTagName
138384.1 Ops/sec
HTML Preparation code:
<div></div> <p><b>bar <s>baz <i>some</i></s> fab</b></p> <div><small>terms of text</small> more text nodes <b>here</b></div> <div><p> text nodes <kbd>var</kbd> here </p></div> <div><ul><li>some list items</li><li>2nd item</li></ul></div> <div><p><i>test <b>some</b></i></p></div> <div>lorem</div> <div><b>foo</b></div> <div>ipsum</div> <section><div><article><h1>Test</h1></article></div></section>
Tests:
querySelectorAll
const allDivs = document.querySelectorAll('*'); allDivs.forEach(function (div) {});
getElementsByTagName
const allDivs = document.getElementsByTagName('*'); const arrayAllDivs = Array.from(allDivs); arrayAllDivs.forEach(function (div) {});