Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Firefox 68
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 1257135.1 Ops/sec
jQuery (tag.id) 195290.6 Ops/sec
jQuery (tag#id) 186453.3 Ops/sec
jQuery (.id) 279293.6 Ops/sec
jQuery (#id) 858538.4 Ops/sec
Cash + getElementsByClassName 382788.2 Ops/sec
Cash + getElementById 539589.2 Ops/sec
Cash (tag.id) 253520.1 Ops/sec
jQuery + getElementById 940728.6 Ops/sec
Cash (tag#id) 213554.9 Ops/sec
Cash (#id) 996995.2 Ops/sec
querySelectorAll (.id) 540479.7 Ops/sec
querySelectorAll (#id) 515852.9 Ops/sec
querySelector (.id) 1519396.0 Ops/sec
querySelector (#id) 1526678.9 Ops/sec
getElementsByTagName 1405624.9 Ops/sec
getElementsByClassName 999005.1 Ops/sec
Cash (.id) 473526.8 Ops/sec
jQuery + getElementsByClassName 308572.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


;