Tests:
-
document.getElementById
-
document.querySelector
-
element.querySelector
Rendered benchmark preparation results:
Latest run results:
Run details: (Test run date:
one year ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122 on Linux
View result in a separate tab
element.querySelector
6.9M/s
document.getElementById
6.3M/s
document.querySelector
2.7M/s
View exact numbers
| Test name |
Executions per second |
|
✓
element.querySelector
|
6,882,864 Ops/sec |
|
document.getElementById
|
6,272,103 Ops/sec |
|
document.querySelector
|
2,674,466 Ops/sec |
Do you really want to delete benchmark?