Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36
Chrome 80
Linux
Desktop
4 years ago
Test name Executions per second
getElementById() 2495916.0 Ops/sec
getElementsByClassName() 1746525.5 Ops/sec
getElementsByTagName() 2062787.6 Ops/sec
querySelector(#id) 1549236.1 Ops/sec
querySelector(.id) 2704546.5 Ops/sec
querySelectorAll(#id) 884122.8 Ops/sec
querySelectorAll(.id) 1195183.8 Ops/sec
jQuery(#id) 1406002.6 Ops/sec
jQuery(.id) 472651.0 Ops/sec
jQuery(tag#id) 350872.6 Ops/sec
jQuery(tag.id) 369482.0 Ops/sec
jQuery + getElementById 1214479.9 Ops/sec
jQuery + getElementsByClassName 478485.7 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


;