Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0
Firefox 111
Mac OS X 10.15
Desktop
one year ago
Test name Executions per second
getElementById 5384250.5 Ops/sec
jQuery (tag.id) 887449.9 Ops/sec
jQuery (tag#id) 810229.0 Ops/sec
jQuery (.id) 1510551.8 Ops/sec
jQuery (#id) 5051019.5 Ops/sec
Cash + getElementsByClassName 1743717.2 Ops/sec
Cash + getElementById 3057640.8 Ops/sec
Cash (tag.id) 1094518.6 Ops/sec
jQuery + getElementById 3219044.0 Ops/sec
Cash (tag#id) 902798.2 Ops/sec
Cash (#id) 4875957.0 Ops/sec
querySelectorAll (.id) 1522880.6 Ops/sec
querySelectorAll (#id) 1233306.2 Ops/sec
querySelector (.id) 3321883.5 Ops/sec
querySelector (#id) 3311786.5 Ops/sec
getElementsByTagName 4435517.5 Ops/sec
getElementsByClassName 2521012.8 Ops/sec
Cash (.id) 1690223.2 Ops/sec
jQuery + getElementsByClassName 819359.9 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