getElementsByClass, querySelector
Date tested:
6 years ago
User agent:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
Test name
Executions per second
getElementById
0.0 Ops/sec
querySelector
818043.2 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<div class="test">Test</div>
Tests:
getElementById
document.getElementsByClass("test");
querySelector
document.querySelector(".test")
Open this result on MeasureThat.net