Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Mac OS X 10.14
Desktop
6 years ago
Test name Executions per second
getElementById 1818522.9 Ops/sec
querySelector 1916759.1 Ops/sec
HTML Preparation code:
AخA
 
1
<div id="testElement"></div>
Tests:
  • getElementById

     
    var el = document.getElementById('testElement');
    var className = el.className;
  • querySelector

     
    var el = document.querySelector('#testElement');
    var className = el.className;