Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Firefox 91
Ubuntu
Desktop
3 years ago
Test name Executions per second
querySelector ID 2192551.5 Ops/sec
querySelector CLASS 2105646.5 Ops/sec
querySelector ATTR 1029619.9 Ops/sec
getElementById 2479026.0 Ops/sec
getElementsByClassName 1713252.4 Ops/sec
getElementsByTagName 1756070.9 Ops/sec
HTML Preparation code:
Tests:
  • querySelector ID

  • querySelector CLASS

  • querySelector ATTR

  • getElementById

  • getElementsByClassName

  • getElementsByTagName