Run details:
Mozilla/5.0 (Linux; Android 7.1.2; ONE A2005) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36
Chrome Mobile 70
Android 7.1.2
Mobile
6 years ago
Test name Executions per second
getElementById() 932475.3 Ops/sec
getElementsByClassName() 533654.4 Ops/sec
getElementsByTagName() 646598.4 Ops/sec
querySelector(#id) 376658.9 Ops/sec
querySelector(.id) 512858.9 Ops/sec
querySelectorAll(#id) 217670.5 Ops/sec
querySelectorAll(.id) 228427.6 Ops/sec
jQuery(#id) 241022.4 Ops/sec
jQuery(.id) 134848.1 Ops/sec
jQuery(tag#id) 73893.9 Ops/sec
jQuery(tag.id) 76960.0 Ops/sec
jQuery + getElementById 304516.5 Ops/sec
jQuery + getElementsByClassName 101598.0 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