Test name | Executions per second |
---|---|
querySelector | 7633516.0 Ops/sec |
querySelectorAll | 3319084.2 Ops/sec |
getElementsByClassName | 10138225.0 Ops/sec |
querySelector (ID) | 5539668.5 Ops/sec |
getElementsByID | 9775568.0 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")