Run details:
Mozilla/5.0 (Android; Mobile; rv:40.0) Gecko/40.0 Firefox/40.0
Firefox Mobile 40
Android
Other
8 years ago
Test name Executions per second
getElementById 1364469.0 Ops/sec
getElementsByClassName 277828.8 Ops/sec
querySelector 648588.9 Ops/sec
querySelectorAll 231959.7 Ops/sec
jQuery 583984.1 Ops/sec
jQuery + getElementById 772478.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