Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome 87
Mac OS X 10.15.6
Desktop
3 years ago
Test name Executions per second
getElementById 2829146.0 Ops/sec
jQuery (tag.id) 316854.1 Ops/sec
jQuery (tag#id) 297261.0 Ops/sec
jQuery (.id) 408993.2 Ops/sec
jQuery (#id) 1310453.9 Ops/sec
Cash + getElementsByClassName 668196.2 Ops/sec
Cash + getElementById 1023873.3 Ops/sec
Cash (tag.id) 361207.6 Ops/sec
jQuery + getElementById 1068348.5 Ops/sec
Cash (tag#id) 322411.8 Ops/sec
Cash (#id) 1523408.4 Ops/sec
querySelectorAll (.id) 1125076.0 Ops/sec
querySelectorAll (#id) 881723.8 Ops/sec
querySelector (.id) 2742150.5 Ops/sec
querySelector (#id) 1719594.0 Ops/sec
getElementsByTagName 2395433.8 Ops/sec
getElementsByClassName 1961226.9 Ops/sec
Cash (.id) 473693.8 Ops/sec
jQuery + getElementsByClassName 411338.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


;