Last active
July 17, 2022 12:25
-
-
Save donbrae/0276d43b831af40d1bbe529549a66f84 to your computer and use it in GitHub Desktop.
`getElementById` vs `querySelector` vs `getElementsByClassName` vs `getElementsByName` vs `getElementsByTagName`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://measurethat.net/Benchmarks/ShowResult/170533 | |
Test name | Executions per second | |
----------------------------------------------- | |
getElementById | 9,737,553 ops/sec | |
getElementsByName | 6,090,861 ops/sec | |
querySelector | 5,577,396 ops/sec | |
getElementsByTagName | 4,900,635 ops/sec | |
getElementsByClassName | 4,736,003 ops/sec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment