Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36
Chrome 88
Mac OS X 11.2.2
Desktop
3 years ago
Test name Executions per second
getElementById 1453847.1 Ops/sec
jQuery (tag.id) 235118.9 Ops/sec
jQuery (tag#id) 239150.0 Ops/sec
jQuery (.id) 391653.4 Ops/sec
jQuery (#id) 1104907.9 Ops/sec
Cash + getElementsByClassName 623104.4 Ops/sec
Cash + getElementById 726465.3 Ops/sec
Cash (tag.id) 315094.7 Ops/sec
jQuery + getElementById 879903.4 Ops/sec
Cash (tag#id) 253642.3 Ops/sec
Cash (#id) 1011463.8 Ops/sec
querySelectorAll (.id) 910650.8 Ops/sec
querySelectorAll (#id) 563451.2 Ops/sec
querySelector (.id) 1952042.4 Ops/sec
querySelector (#id) 1235811.0 Ops/sec
getElementsByTagName 1567359.2 Ops/sec
getElementsByClassName 1067485.6 Ops/sec
Cash (.id) 355334.9 Ops/sec
jQuery + getElementsByClassName 372775.2 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