Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/71.0.3578.98 Chrome/71.0.3578.98 Safari/537.36
Chromium 71
Linux
Desktop
5 years ago
Test name Executions per second
getElementById() 2548023.8 Ops/sec
getElementsByClassName() 1685817.9 Ops/sec
getElementsByTagName() 2028130.6 Ops/sec
querySelector(#id) 1744348.9 Ops/sec
querySelector(.id) 2112474.5 Ops/sec
querySelectorAll(#id) 684574.5 Ops/sec
querySelectorAll(.id) 766439.5 Ops/sec
jQuery(#id) 952023.4 Ops/sec
jQuery(.id) 435000.2 Ops/sec
jQuery(tag#id) 269383.6 Ops/sec
jQuery(tag.id) 280040.8 Ops/sec
jQuery + getElementById 1029881.2 Ops/sec
jQuery + getElementsByClassName 379735.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


;