Run details:
Mozilla/5.0 (Linux; U; Linux aarch64; en-US) AppleWebKit/602.1+ (KHTML, like Gecko) Espial/6.8.6 Version/4.0 Safari/602.1+
WebKit Nightly 602
Linux
Desktop
4 years ago
Test name Executions per second
getElementById() 1047464.3 Ops/sec
getElementsByClassName() 694934.7 Ops/sec
getElementsByTagName() 785293.5 Ops/sec
querySelector(#id) 432295.0 Ops/sec
querySelector(.id) 726649.2 Ops/sec
querySelectorAll(#id) 273531.8 Ops/sec
querySelectorAll(.id) 431319.4 Ops/sec
jQuery(#id) 313935.8 Ops/sec
jQuery(.id) 153857.8 Ops/sec
jQuery(tag#id) 94218.7 Ops/sec
jQuery(tag.id) 94311.7 Ops/sec
jQuery + getElementById 451840.2 Ops/sec
jQuery + getElementsByClassName 204027.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