Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 2566131.0 Ops/sec
getElementsByClassName() 1479001.1 Ops/sec
getElementsByTagName() 2129076.5 Ops/sec
querySelector(#id) 1593155.1 Ops/sec
querySelector(.id) 2021858.5 Ops/sec
querySelectorAll(#id) 670095.9 Ops/sec
querySelectorAll(.id) 891942.5 Ops/sec
jQuery(#id) 834065.3 Ops/sec
jQuery(.id) 405431.7 Ops/sec
jQuery(tag#id) 277856.0 Ops/sec
jQuery(tag.id) 276777.8 Ops/sec
jQuery + getElementById 1107863.6 Ops/sec
jQuery + getElementsByClassName 375647.7 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • getElementsByClassName

  • getElementsByTagName

  • querySelector (#id)

  • querySelector (.id)

  • querySelectorAll (#id)

  • querySelectorAll (.id)

  • Cash (#id)

  • Cash (.id)

  • Cash (tag#id)

  • Cash (tag.id)

  • Cash + getElementById

  • Cash + getElementsByClassName

  • jQuery (#id)

  • jQuery (.id)

  • jQuery (tag#id)

  • jQuery (tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName


;