Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Chrome 84
Mac OS X 10.15.6
Desktop
4 years ago
Test name Executions per second
getElementsById + getElementsByClassName 2939583.5 Ops/sec
querySelector + querySelector 1774255.2 Ops/sec
querySelector 2358850.5 Ops/sec
cache + getElementsByClassName 3315740.0 Ops/sec
cache + querySelector 2912408.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • getElementsById + getElementsByClassName

  • querySelector + querySelector

  • querySelector

  • cache + getElementsByClassName

  • cache + querySelector