Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Linux
Desktop
5 years ago
Test name Executions per second
getElementById() 1028632.0 Ops/sec
getElementsByClassName() 1057625.6 Ops/sec
getElementsByTagName() 1255337.1 Ops/sec
querySelector(#id) 1263273.2 Ops/sec
querySelector(.id) 1206710.5 Ops/sec
querySelectorAll(tag#id) 319226.3 Ops/sec
querySelectorAll(.id) 406968.1 Ops/sec
jQuery(#id) 1026381.4 Ops/sec
jQuery(.id) 240928.2 Ops/sec
jQuery(tag#id) 109965.4 Ops/sec
jQuery(tag.id) 118647.0 Ops/sec
jQuery + getElementById 824005.8 Ops/sec
jQuery + getElementsByClassName 305855.9 Ops/sec
HTML Preparation code:
Tests:
  • getElementById()

  • getElementsByClassName()

  • getElementsByTagName()

  • querySelector(#id)

  • querySelector(.id)

  • querySelectorAll(tag#id)

  • querySelectorAll(.id)

  • jQuery(#id)

  • jQuery(.id)

  • jQuery(tag#id)

  • jQuery(tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName


;