Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Chrome 69
Mac OS X 10.14.0
Desktop
6 years ago
Test name Executions per second
getElementById() 3055007.2 Ops/sec
getElementsByClassName() 1992693.1 Ops/sec
getElementsByTagName() 2419153.0 Ops/sec
querySelector(#id) 1764046.2 Ops/sec
querySelector(.id) 2441714.0 Ops/sec
querySelectorAll(#id) 801332.4 Ops/sec
querySelectorAll(.id) 1018150.1 Ops/sec
jQuery(#id) 1116162.6 Ops/sec
jQuery(.id) 535580.2 Ops/sec
jQuery(tag#id) 271725.5 Ops/sec
jQuery(tag.id) 272689.5 Ops/sec
jQuery + getElementById 1167851.2 Ops/sec
jQuery + getElementsByClassName 431773.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


;