Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0
Firefox 65
Mac OS X 10.14
Desktop
5 years ago
Test name Executions per second
getElementById() 424987.7 Ops/sec
getElementsByClassName() 2479721.0 Ops/sec
getElementsByTagName() 555855.6 Ops/sec
querySelector(#id) 591725.9 Ops/sec
querySelector(.id) 444829.1 Ops/sec
querySelectorAll(#id) 105047.0 Ops/sec
querySelectorAll(.id) 116527.6 Ops/sec
jQuery(#id) 62439.5 Ops/sec
jQuery(.id) 34913.6 Ops/sec
jQuery(tag#id) 62485.7 Ops/sec
jQuery(tag.id) 88756.3 Ops/sec
jQuery + getElementById 139955.4 Ops/sec
jQuery + getElementsByClassName 121944.5 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


;