Test name | Executions per second |
---|---|
querySelector | 4858125.0 Ops/sec |
querySelectorAll | 3186030.5 Ops/sec |
getElementsByClassName | 5920438.5 Ops/sec |
querySelector (ID) | 4524145.0 Ops/sec |
getElementsByID | 6706219.0 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")