Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
getElementsById + getElementsByClassName 2167442.8 Ops/sec
querySelector + querySelector 1372145.2 Ops/sec
querySelector 1909224.9 Ops/sec
cache + getElementsByClassName 2477965.5 Ops/sec
cache + querySelector 2492925.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • getElementsById + getElementsByClassName

  • querySelector + querySelector

  • querySelector

  • cache + getElementsByClassName

  • cache + querySelector