Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
Firefox 77
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3180694.2 Ops/sec
jQuery (tag.id) 479515.3 Ops/sec
jQuery (tag#id) 458395.3 Ops/sec
jQuery (.id) 792698.7 Ops/sec
jQuery (#id) 4145564.2 Ops/sec
Cash + getElementsByClassName 1314776.8 Ops/sec
Cash + getElementById 2164400.2 Ops/sec
Cash (tag.id) 876762.1 Ops/sec
jQuery + getElementById 2366183.0 Ops/sec
Cash (tag#id) 815394.9 Ops/sec
Cash (#id) 4539360.5 Ops/sec
querySelectorAll (.id) 1025949.9 Ops/sec
querySelectorAll (#id) 926478.3 Ops/sec
querySelector (.id) 2527265.8 Ops/sec
querySelector (#id) 2508915.2 Ops/sec
getElementsByTagName 2530007.0 Ops/sec
getElementsByClassName 2002273.1 Ops/sec
Cash (.id) 1521586.4 Ops/sec
jQuery + getElementsByClassName 705211.1 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


;