Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Chrome 69
Mac OS X 10.13.4
Desktop
6 years ago
Test name Executions per second
getElementById() 2109905.8 Ops/sec
getElementsByClassName() 1348113.1 Ops/sec
getElementsByTagName() 1641567.8 Ops/sec
querySelector(#id) 1199136.8 Ops/sec
querySelector(.id) 1684633.9 Ops/sec
querySelectorAll(#id) 507452.3 Ops/sec
querySelectorAll(.id) 617333.2 Ops/sec
jQuery(#id) 517916.4 Ops/sec
jQuery(.id) 186072.0 Ops/sec
jQuery(tag#id) 113154.4 Ops/sec
jQuery(tag.id) 109770.1 Ops/sec
jQuery + getElementById 749097.1 Ops/sec
jQuery + getElementsByClassName 173789.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


;