Test name | Executions per second |
---|---|
getElementById | 195328.4 Ops/sec |
getElementsByClassName | 235255.2 Ops/sec |
querySelector | 235501.8 Ops/sec |
<div id="a" class="b"></div>
document.getElementById('a');
a.innerHTML="abc";
let b = document.getElementsByClassName('b')[0];
b.innerHTML="def";
let c =document.querySelector(".b");
c.innerHTML="ghi";