Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Firefox 88
Linux
Desktop
3 years ago
Test name Executions per second
getElementById 5901822.5 Ops/sec
querySelector (id) 2038160.5 Ops/sec
getElementsByClassName 6036097.0 Ops/sec
querySelector (class) 1730290.4 Ops/sec
getElementsByTagName 6042756.0 Ops/sec
querySelector (tag) 2088128.2 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • querySelector (id)

  • getElementsByClassName

  • querySelector (class)

  • getElementsByTagName

  • querySelector (tag)