Test name | Executions per second |
---|---|
querySelector | 3706062.8 Ops/sec |
querySelectorAll | 1777877.8 Ops/sec |
getElementsByClassName | 4444178.0 Ops/sec |
querySelector (ID) | 2607892.2 Ops/sec |
getElementsByID | 3404577.2 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")