Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1
Mobile Safari 9
iOS 9.3.5
iPhone
7 years ago
Test name Executions per second
getElementById() 494438.7 Ops/sec
getElementsByClassName() 533146.6 Ops/sec
getElementsByTagName() 364274.8 Ops/sec
querySelector(#id) 321148.9 Ops/sec
querySelector(.id) 71358.8 Ops/sec
querySelectorAll(#id) 214845.1 Ops/sec
querySelectorAll(.id) 5306.8 Ops/sec
jQuery(#id) 115134.4 Ops/sec
jQuery(.id) 38768.5 Ops/sec
jQuery(tag#id) 36505.0 Ops/sec
jQuery(tag.id) 5792.9 Ops/sec
jQuery + getElementById 169287.4 Ops/sec
jQuery + getElementsByClassName 69273.4 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


;