Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0
Firefox 99
Windows
Desktop
2 years ago
Test name Executions per second
getElementById() 5492915.5 Ops/sec
getElementsByClassName() 3973092.0 Ops/sec
getElementsByTagName() 3983847.2 Ops/sec
querySelector(#id) 3536281.0 Ops/sec
querySelector(.id) 3667265.8 Ops/sec
querySelectorAll(#id) 1325702.6 Ops/sec
querySelectorAll(.id) 1525003.2 Ops/sec
umbrella(#id) 519896.9 Ops/sec
umbrella(.id) 556399.9 Ops/sec
umbrella(tag#id) 508081.0 Ops/sec
umbrella(tag.id) 545771.9 Ops/sec
umbrella + getElementById 935060.6 Ops/sec
umbrella + getElementsByClassName 680658.4 Ops/sec
umbrella + querySelectorAll 589236.6 Ops/sec
querySelectorAll in function 1552096.9 Ops/sec
HTML Preparation code:
Tests:
  • getElementById()

  • getElementsByClassName()

  • getElementsByTagName()

  • querySelector(#id)

  • querySelector(.id)

  • querySelectorAll(#id)

  • querySelectorAll(.id)

  • umbrella(#id)

  • umbrella(.id)

  • umbrella(tag#id)

  • umbrella(tag.id)

  • umbrella + getElementById

  • umbrella + getElementsByClassName

  • umbrella + querySelectorAll

  • querySelectorAll in function