HTML Preparation code:
AخA
 
1
<div id="testElement" data-x="xxx"></div>
Tests:
  • getElementById

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

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

     
    var el = document.querySelector('[data-x=xxx]');
    var className = el.className;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    getElementById
    querySelector
    data

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 24 days ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Linux
View result in a separate tab
Test name Executions per second
getElementById 24300790.0 Ops/sec
querySelector 9083351.0 Ops/sec
data 13653726.0 Ops/sec