Run details:
Mozilla/5.0 (Android 6.0.1; Mobile; rv:52.0) Gecko/52.0 Firefox/52.0
Firefox Mobile 52
Android 6.0.1
Other
7 years ago
Test name Executions per second
getElementById() 1613546.5 Ops/sec
getElementsByClassName() 275721.7 Ops/sec
getElementsByTagName() 488182.6 Ops/sec
querySelector(#id) 707869.4 Ops/sec
querySelector(.id) 48111.4 Ops/sec
querySelectorAll(#id) 66561.4 Ops/sec
querySelectorAll(.id) 8047.6 Ops/sec
jQuery(#id) 295354.4 Ops/sec
jQuery(.id) 21938.5 Ops/sec
jQuery(tag#id) 15683.5 Ops/sec
jQuery(tag.id) 5629.2 Ops/sec
jQuery + getElementById 179279.0 Ops/sec
jQuery + getElementsByClassName 25897.6 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