Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134
Edge 17.17134
Windows
Desktop
6 years ago
Test name Executions per second
getElementById() 3011233.0 Ops/sec
getElementsByClassName() 783244.5 Ops/sec
getElementsByTagName() 544642.9 Ops/sec
querySelector(#id) 1100148.5 Ops/sec
querySelector(.id) 747556.6 Ops/sec
querySelectorAll(#id) 738855.4 Ops/sec
querySelectorAll(.id) 318199.4 Ops/sec
jQuery(#id) 673044.0 Ops/sec
jQuery(.id) 223074.4 Ops/sec
jQuery(tag#id) 175665.4 Ops/sec
jQuery(tag.id) 151725.3 Ops/sec
jQuery + getElementById 649614.4 Ops/sec
jQuery + getElementsByClassName 154722.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


;