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() 4205073.5 Ops/sec
getElementsByClassName() 3487256.0 Ops/sec
getElementsByTagName() 3645763.8 Ops/sec
querySelector(#id) 1548408.9 Ops/sec
querySelector(.id) 2877805.2 Ops/sec
querySelectorAll(#id) 894789.1 Ops/sec
querySelectorAll(.id) 1377110.2 Ops/sec
jQuery(#id) 1131668.9 Ops/sec
jQuery(.id) 413726.3 Ops/sec
jQuery(tag#id) 264595.5 Ops/sec
jQuery(tag.id) 257875.6 Ops/sec
jQuery + getElementById 1532430.8 Ops/sec
jQuery + getElementsByClassName 551599.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