Test name | Executions per second |
---|---|
querySelector | 3107962.2 Ops/sec |
querySelectorAll | 1393373.9 Ops/sec |
getElementsByClassName | 3803106.2 Ops/sec |
querySelector (ID) | 2042925.5 Ops/sec |
getElementsByID | 3567123.0 Ops/sec |
<div class="test" id="test"></div>
document.querySelector(".test")
document.querySelectorAll(".test")
document.getElementsByClassName(".test")
document.querySelector("#test")
document.getElementById("test")