Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:66.0) Gecko/20100101 Firefox/66.0
Firefox 66
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 2370314.2 Ops/sec
getElementsByClassName() 2363471.8 Ops/sec
getElementsByTagName() 2637723.0 Ops/sec
querySelector(#id) 2656865.0 Ops/sec
querySelector(.id) 2623980.8 Ops/sec
querySelectorAll(#id) 1113769.4 Ops/sec
querySelectorAll(.id) 1253809.8 Ops/sec
jQuery(#id) 2967415.8 Ops/sec
jQuery(.id) 865785.4 Ops/sec
jQuery(tag#id) 513368.4 Ops/sec
jQuery(tag.id) 573587.2 Ops/sec
jQuery + getElementById 1964816.1 Ops/sec
jQuery + getElementsByClassName 864413.8 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


;