Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
Firefox 61
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 1584252.2 Ops/sec
getElementsByClassName() 1701767.8 Ops/sec
getElementsByTagName() 2026098.2 Ops/sec
querySelector(#id) 1860071.1 Ops/sec
querySelector(.id) 1787302.2 Ops/sec
querySelectorAll(#id) 565335.0 Ops/sec
querySelectorAll(.id) 724577.1 Ops/sec
jQuery(#id) 1947176.6 Ops/sec
jQuery(.id) 421996.8 Ops/sec
jQuery(tag#id) 205000.3 Ops/sec
jQuery(tag.id) 203383.4 Ops/sec
jQuery + getElementById 1675389.4 Ops/sec
jQuery + getElementsByClassName 374345.4 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


;