Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 759282.1 Ops/sec
jQuery (tag.id) 113053.7 Ops/sec
jQuery (tag#id) 124236.3 Ops/sec
jQuery (.id) 127748.2 Ops/sec
jQuery (#id) 485585.2 Ops/sec
Cash + getElementsByClassName 244440.3 Ops/sec
Cash + getElementById 328760.6 Ops/sec
Cash (tag.id) 154297.1 Ops/sec
jQuery + getElementById 381033.9 Ops/sec
Cash (tag#id) 157940.1 Ops/sec
Cash (#id) 455780.2 Ops/sec
querySelectorAll (.id) 527430.1 Ops/sec
querySelectorAll (#id) 351420.2 Ops/sec
querySelector (.id) 801610.5 Ops/sec
querySelector (#id) 530434.8 Ops/sec
getElementsByTagName 620357.5 Ops/sec
getElementsByClassName 562871.0 Ops/sec
Cash (.id) 187108.8 Ops/sec
jQuery + getElementsByClassName 131073.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