HTML Preparation code:
Tests:
  • getElementById()

  • getElementsByClassName()

  • getElementsByTagName()

  • querySelector(#id)

  • querySelector(.id)

  • querySelectorAll(#id)

  • querySelectorAll(.id)

  • jQuery(#id)

  • jQuery(.id)

  • jQuery(tag#id)

  • jQuery(tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName

  • jQuery + querySelectorAll

  • querySelectorAll in function

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    getElementById()
    getElementsByClassName()
    getElementsByTagName()
    querySelector(#id)
    querySelector(.id)
    querySelectorAll(#id)
    querySelectorAll(.id)
    jQuery(#id)
    jQuery(.id)
    jQuery(tag#id)
    jQuery(tag.id)
    jQuery + getElementById
    jQuery + getElementsByClassName
    jQuery + querySelectorAll
    querySelectorAll in function

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
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 on Windows
View result in a separate tab
Test name Executions per second
getElementById() 1999591.2 Ops/sec
getElementsByClassName() 1576964.0 Ops/sec
getElementsByTagName() 1509362.4 Ops/sec
querySelector(#id) 894847.6 Ops/sec
querySelector(.id) 1193722.4 Ops/sec
querySelectorAll(#id) 560118.6 Ops/sec
querySelectorAll(.id) 650933.7 Ops/sec
jQuery(#id) 509794.1 Ops/sec
jQuery(.id) 300375.0 Ops/sec
jQuery(tag#id) 236997.5 Ops/sec
jQuery(tag.id) 252474.0 Ops/sec
jQuery + getElementById 636511.9 Ops/sec
jQuery + getElementsByClassName 173642.6 Ops/sec
jQuery + querySelectorAll 214246.8 Ops/sec
querySelectorAll in function 680490.4 Ops/sec


;