Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Chrome 87
Mac OS X 10.13.6
Desktop
3 years ago
Test name Executions per second
getElementById 3231729.5 Ops/sec
jQuery (tag.id) 424062.3 Ops/sec
jQuery (tag#id) 377478.3 Ops/sec
jQuery (.id) 543046.4 Ops/sec
jQuery (#id) 1616160.1 Ops/sec
Cash + getElementsByClassName 1007261.9 Ops/sec
Cash + getElementById 1287856.1 Ops/sec
Cash (tag.id) 501988.7 Ops/sec
jQuery + getElementById 1277547.2 Ops/sec
Cash (tag#id) 451135.0 Ops/sec
Cash (#id) 1919462.4 Ops/sec
querySelectorAll (.id) 1485951.0 Ops/sec
querySelectorAll (#id) 1065849.2 Ops/sec
querySelector (.id) 3145237.5 Ops/sec
querySelector (#id) 1924715.2 Ops/sec
getElementsByTagName 2674611.5 Ops/sec
getElementsByClassName 2235010.0 Ops/sec
Cash (.id) 648839.5 Ops/sec
jQuery + getElementsByClassName 581132.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