Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2121092.5 Ops/sec
jQuery (tag.id) 278405.0 Ops/sec
jQuery (tag#id) 263984.2 Ops/sec
jQuery (.id) 382303.7 Ops/sec
jQuery (#id) 1179127.9 Ops/sec
Cash + getElementsByClassName 628444.9 Ops/sec
Cash + getElementById 839120.4 Ops/sec
Cash (tag.id) 340160.5 Ops/sec
jQuery + getElementById 889068.8 Ops/sec
Cash (tag#id) 299171.1 Ops/sec
Cash (#id) 1261904.9 Ops/sec
querySelectorAll (.id) 1119020.8 Ops/sec
querySelectorAll (#id) 726475.8 Ops/sec
querySelector (.id) 2155979.8 Ops/sec
querySelector (#id) 1219724.9 Ops/sec
getElementsByTagName 1632186.6 Ops/sec
getElementsByClassName 1359076.0 Ops/sec
Cash (.id) 380148.4 Ops/sec
jQuery + getElementsByClassName 359193.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


;