Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36
Chrome 69
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 2726073.8 Ops/sec
getElementsByClassName() 1661869.8 Ops/sec
getElementsByTagName() 2271429.8 Ops/sec
querySelector(#id) 1696554.8 Ops/sec
querySelector(.id) 2395438.2 Ops/sec
querySelectorAll(#id) 671407.9 Ops/sec
querySelectorAll(.id) 859648.8 Ops/sec
jQuery(#id) 647525.0 Ops/sec
jQuery(.id) 274298.5 Ops/sec
jQuery(tag#id) 161371.1 Ops/sec
jQuery(tag.id) 166290.1 Ops/sec
jQuery + getElementById 928774.8 Ops/sec
jQuery + getElementsByClassName 261284.5 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


;