Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Firefox 65
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 1263187.5 Ops/sec
getElementsByClassName() 1330304.1 Ops/sec
getElementsByTagName() 1864654.4 Ops/sec
querySelector(#id) 1437825.4 Ops/sec
querySelector(.id) 1685394.0 Ops/sec
querySelectorAll(#id) 683296.9 Ops/sec
querySelectorAll(.id) 791487.4 Ops/sec
jQuery(#id) 1773534.8 Ops/sec
jQuery(.id) 526738.0 Ops/sec
jQuery(tag#id) 283624.2 Ops/sec
jQuery(tag.id) 320434.5 Ops/sec
jQuery + getElementById 1306620.5 Ops/sec
jQuery + getElementsByClassName 445157.3 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


;