Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 1539391.2 Ops/sec
getElementsByClassName() 1345953.9 Ops/sec
getElementsByTagName() 1388104.0 Ops/sec
querySelector(#id) 1095846.8 Ops/sec
querySelector(.id) 1677497.6 Ops/sec
querySelectorAll(#id) 570072.3 Ops/sec
querySelectorAll(.id) 739052.7 Ops/sec
umbrella(#id) 205420.8 Ops/sec
umbrella(.id) 189787.3 Ops/sec
umbrella(tag#id) 172449.6 Ops/sec
umbrella(tag.id) 187385.5 Ops/sec
umbrella + getElementById 429227.1 Ops/sec
umbrella + getElementsByClassName 240030.1 Ops/sec
umbrella + querySelectorAll 226887.8 Ops/sec
querySelectorAll in function 762973.0 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


;