Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36
Chrome 73
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 3678871.2 Ops/sec
getElementsByClassName() 2245012.8 Ops/sec
getElementsByTagName() 2868090.2 Ops/sec
querySelector(#id) 2154841.8 Ops/sec
querySelector(.id) 2898420.5 Ops/sec
querySelectorAll(#id) 865239.6 Ops/sec
querySelectorAll(.id) 1079791.9 Ops/sec
jQuery(#id) 1184436.1 Ops/sec
jQuery(.id) 656343.1 Ops/sec
jQuery(tag#id) 362500.0 Ops/sec
jQuery(tag.id) 396050.4 Ops/sec
jQuery + getElementById 1365751.2 Ops/sec
jQuery + getElementsByClassName 547067.6 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


;