Run details:
Mozilla/5.0 (Android 10; Mobile; rv:82.0) Gecko/82.0 Firefox/82.0
Firefox Mobile 82
Android
Mobile
4 years ago
Test name Executions per second
getElementById 1446383.6 Ops/sec
jQuery (tag.id) 184734.5 Ops/sec
jQuery (tag#id) 182650.8 Ops/sec
jQuery (.id) 336884.9 Ops/sec
jQuery (#id) 1715128.4 Ops/sec
Cash + getElementsByClassName 572801.1 Ops/sec
Cash + getElementById 1028963.8 Ops/sec
Cash (tag.id) 353023.7 Ops/sec
jQuery + getElementById 1049703.4 Ops/sec
Cash (tag#id) 344299.2 Ops/sec
Cash (#id) 1951523.2 Ops/sec
querySelectorAll (.id) 442114.5 Ops/sec
querySelectorAll (#id) 414342.7 Ops/sec
querySelector (.id) 1199763.8 Ops/sec
querySelector (#id) 1205331.6 Ops/sec
getElementsByTagName 1141900.8 Ops/sec
getElementsByClassName 810500.2 Ops/sec
Cash (.id) 672661.7 Ops/sec
jQuery + getElementsByClassName 276857.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