Run details:
Mozilla/5.0 (Linux; U; Linux armv7l; en-US) AppleWebKit/537.1+ (KHTML, like Gecko) Espial/6.8.6 Version/4.0 Safari/537.1+ AQUOS_DTV/2.0 (Sharp, LC-60UQ15U, wired)
WebKit Nightly 537
Linux
Desktop
4 years ago
Test name Executions per second
getElementById() 4329674.5 Ops/sec
getElementsByClassName() 3482748.2 Ops/sec
getElementsByTagName() 3816410.2 Ops/sec
querySelector(#id) 1514645.2 Ops/sec
querySelector(.id) 2859669.2 Ops/sec
querySelectorAll(#id) 1013923.9 Ops/sec
querySelectorAll(.id) 1330900.9 Ops/sec
jQuery(#id) 1249214.1 Ops/sec
jQuery(.id) 372023.2 Ops/sec
jQuery(tag#id) 244498.7 Ops/sec
jQuery(tag.id) 255643.5 Ops/sec
jQuery + getElementById 1629572.5 Ops/sec
jQuery + getElementsByClassName 499060.2 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