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() 1103597.0 Ops/sec
getElementsByClassName() 963067.7 Ops/sec
getElementsByTagName() 871231.8 Ops/sec
querySelector(#id) 483429.7 Ops/sec
querySelector(.id) 855725.8 Ops/sec
querySelectorAll(#id) 306051.8 Ops/sec
querySelectorAll(.id) 448426.0 Ops/sec
jQuery(#id) 278378.2 Ops/sec
jQuery(.id) 181501.8 Ops/sec
jQuery(tag#id) 113635.4 Ops/sec
jQuery(tag.id) 112980.4 Ops/sec
jQuery + getElementById 447753.1 Ops/sec
jQuery + getElementsByClassName 241065.0 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