Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3555092.5 Ops/sec
getElementsByClassName() 3006329.2 Ops/sec
getElementsByTagName() 3015541.2 Ops/sec
querySelector(#id) 2290078.2 Ops/sec
querySelector(.id) 3753588.2 Ops/sec
querySelectorAll(#id) 1142587.5 Ops/sec
querySelectorAll(.id) 1689153.9 Ops/sec
umbrella(#id) 425791.6 Ops/sec
umbrella(.id) 374373.2 Ops/sec
umbrella(tag#id) 342559.2 Ops/sec
umbrella(tag.id) 372598.1 Ops/sec
umbrella + getElementById 1002369.6 Ops/sec
umbrella + getElementsByClassName 518227.2 Ops/sec
umbrella + querySelectorAll 460022.1 Ops/sec
querySelectorAll in function 1706929.6 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