Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 2672300.8 Ops/sec
getElementsByClassName() 2095573.9 Ops/sec
getElementsByTagName() 2111793.5 Ops/sec
querySelector(#id) 1582851.9 Ops/sec
querySelector(.id) 2075233.6 Ops/sec
querySelectorAll(#id) 774755.0 Ops/sec
querySelectorAll(.id) 971745.7 Ops/sec
umbrella(#id) 232900.6 Ops/sec
umbrella(.id) 240407.4 Ops/sec
umbrella(tag#id) 216293.8 Ops/sec
umbrella(tag.id) 231243.1 Ops/sec
umbrella + getElementById 604413.2 Ops/sec
umbrella + getElementsByClassName 246587.2 Ops/sec
umbrella + querySelectorAll 247554.4 Ops/sec
querySelectorAll in function 911301.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