Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.33 Safari/537.36
Chrome 68
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 3596438.0 Ops/sec
getElementsByClassName() 2535567.2 Ops/sec
getElementsByTagName() 2990607.0 Ops/sec
querySelector(#id) 2113935.2 Ops/sec
querySelector(.id) 3089487.2 Ops/sec
querySelectorAll(#id) 853673.4 Ops/sec
querySelectorAll(.id) 1081446.5 Ops/sec
jQuery(#id) 1183803.8 Ops/sec
jQuery(.id) 608385.1 Ops/sec
jQuery(tag#id) 372903.6 Ops/sec
jQuery(tag.id) 356309.7 Ops/sec
jQuery + getElementById 1387257.4 Ops/sec
jQuery + getElementsByClassName 479072.3 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


;