Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
querySelectorAll vs. getElementsByTagName with enumeration
(version: 1)
Comparing performance of:
querySelectorAll vs getElementsByTagName
Created:
4 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<table id="data-table"> <tr> <th colspan="6">Results</th> </tr> <tr> <td>No</td> <td>Competition</td> <td>John</td> <td>Adam</td> <td>Robert</td> <td>Paul</td> </tr> <tr> <td>1</td> <td>Swimming</td> <td>1:30</td> <td>2:05</td> <td>1:15</td> <td>1:41</td> </tr> <tr> <td>2</td> <td>Running</td> <td>15:30</td> <td>14:10</td> <td>15:45</td> <td>16:00</td> </tr> <tr> <td>3</td> <td>Shooting</td> <td>70%</td> <td>55%</td> <td>90%</td> <td>88%</td> </tr> </table>
Script Preparation code:
var dataTable = document.getElementById('data-table');
Tests:
querySelectorAll
for (const elem of dataTable.querySelectorAll("tr")) {}
getElementsByTagName
for (const elem of dataTable.getElementsByTagName('TR')) {}
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
querySelectorAll
getElementsByTagName
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser/OS:
Chrome 143 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
querySelectorAll
652052.8 Ops/sec
getElementsByTagName
913321.2 Ops/sec
Related benchmarks:
querySelector vs getElementsByClassName[0] with real dom
querySelectorAll vs. getElementsByTagName
create append create element vs set inner html
create & append element vs set innerHTML
empty children textContent vs replaceChildren(2)
matches vs. closest benchmark
DOM Parser vs insertAdjacentHTML
DOM Parser vs insertAdjacentHTML v2
createContextualFragment vs template.innerHTML
Comments
Confirm delete:
Do you really want to delete benchmark?