Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0
Firefox 76
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 2802079.8 Ops/sec
jQuery (tag.id) 347095.8 Ops/sec
jQuery (tag#id) 327051.2 Ops/sec
jQuery (.id) 571726.6 Ops/sec
jQuery (#id) 3059441.0 Ops/sec
Cash + getElementsByClassName 989905.9 Ops/sec
Cash + getElementById 1659480.2 Ops/sec
Cash (tag.id) 603406.1 Ops/sec
jQuery + getElementById 1937460.4 Ops/sec
Cash (tag#id) 538925.0 Ops/sec
Cash (#id) 3201110.2 Ops/sec
querySelectorAll (.id) 848320.6 Ops/sec
querySelectorAll (#id) 726333.8 Ops/sec
querySelector (.id) 2204109.2 Ops/sec
querySelector (#id) 2207156.0 Ops/sec
getElementsByTagName 2359012.5 Ops/sec
getElementsByClassName 1683871.2 Ops/sec
Cash (.id) 1049866.2 Ops/sec
jQuery + getElementsByClassName 566998.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