Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36 OPR/43.0.2442.806
Opera 43
Windows
Other
7 years ago
Test name Executions per second
getElementById() 2750790.5 Ops/sec
getElementsByClassName() 1797764.5 Ops/sec
getElementsByTagName() 2356675.8 Ops/sec
querySelector(#id) 2348765.8 Ops/sec
querySelector(.id) 578289.2 Ops/sec
querySelectorAll(#id) 1217846.4 Ops/sec
querySelectorAll(.id) 98985.3 Ops/sec
jQuery(#id) 1162217.1 Ops/sec
jQuery(.id) 714200.9 Ops/sec
jQuery(tag#id) 462786.5 Ops/sec
jQuery(tag.id) 83250.8 Ops/sec
jQuery + getElementById 1206450.4 Ops/sec
jQuery + getElementsByClassName 334385.2 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


;