Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134
Linux
Desktop
9 days ago
Test name Executions per second
Query Selector 17816952.0 Ops/sec
Get Element 21232690.0 Ops/sec
HTML Preparation code:
AخA
 
1
<div class="myElement"></div>
Script Preparation code:
 
/*your preparation JavaScript code goes here
To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/
async function globalMeasureThatScriptPrepareFunction() {
    // This function is optional, feel free to remove it.
    // await someThing();
}
Tests:
  • Query Selector

     
    document.querySelector(".myElement");
  • Get Element

     
    document.getElementsByClassName("myElement");