Run details:
Mozilla/5.0 (Linux; Android 7.0; Lenovo TB-8304F1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.119 Safari/537.36
Chrome 80
Android 7.0
Desktop
4 years ago
Test name Executions per second
getElementById() 305126.2 Ops/sec
getElementsByClassName() 215775.7 Ops/sec
getElementsByTagName() 259771.3 Ops/sec
querySelector(#id) 212766.2 Ops/sec
querySelector(.id) 259876.4 Ops/sec
querySelectorAll(#id) 114907.5 Ops/sec
querySelectorAll(.id) 148014.1 Ops/sec
jQuery(#id) 97991.3 Ops/sec
jQuery(.id) 71246.7 Ops/sec
jQuery(tag#id) 47591.2 Ops/sec
jQuery(tag.id) 48919.3 Ops/sec
jQuery + getElementById 151173.4 Ops/sec
jQuery + getElementsByClassName 52699.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


;