Run details:
Mozilla/5.0 (Linux; Android 9; ONEPLUS A6013) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.101 Mobile Safari/537.36
Chrome Mobile 75
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 2175987.2 Ops/sec
getElementsByClassName() 1387416.9 Ops/sec
getElementsByTagName() 1640962.6 Ops/sec
querySelector(#id) 1091794.2 Ops/sec
querySelector(.id) 1493195.8 Ops/sec
querySelectorAll(#id) 605074.2 Ops/sec
querySelectorAll(.id) 771127.6 Ops/sec
jQuery(#id) 847781.6 Ops/sec
jQuery(.id) 459279.4 Ops/sec
jQuery(tag#id) 258905.0 Ops/sec
jQuery(tag.id) 273361.0 Ops/sec
jQuery + getElementById 966017.7 Ops/sec
jQuery + getElementsByClassName 366839.8 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


;