Run details:
Mozilla/5.0 (Linux; Android 8.1.0; MI PAD 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Android 8.1.0
Desktop
4 years ago
Test name Executions per second
getElementById 1449512.0 Ops/sec
jQuery (tag.id) 195388.2 Ops/sec
jQuery (tag#id) 186156.0 Ops/sec
jQuery (.id) 286243.6 Ops/sec
jQuery (#id) 419914.2 Ops/sec
Cash + getElementsByClassName 345363.9 Ops/sec
Cash + getElementById 528495.2 Ops/sec
Cash (tag.id) 299536.6 Ops/sec
jQuery + getElementById 582664.7 Ops/sec
Cash (tag#id) 250487.8 Ops/sec
Cash (#id) 449333.5 Ops/sec
querySelectorAll (.id) 526958.2 Ops/sec
querySelectorAll (#id) 423687.7 Ops/sec
querySelector (.id) 1060589.0 Ops/sec
querySelector (#id) 823631.9 Ops/sec
getElementsByTagName 1079727.8 Ops/sec
getElementsByClassName 883675.2 Ops/sec
Cash (.id) 366459.5 Ops/sec
jQuery + getElementsByClassName 216957.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