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() 1010689.0 Ops/sec
getElementsByClassName() 820410.7 Ops/sec
getElementsByTagName() 817626.1 Ops/sec
querySelector(#id) 482372.2 Ops/sec
querySelector(.id) 850576.2 Ops/sec
querySelectorAll(#id) 308708.4 Ops/sec
querySelectorAll(.id) 478825.4 Ops/sec
jQuery(#id) 323210.8 Ops/sec
jQuery(.id) 155210.8 Ops/sec
jQuery(tag#id) 100134.4 Ops/sec
jQuery(tag.id) 99086.9 Ops/sec
jQuery + getElementById 385540.4 Ops/sec
jQuery + getElementsByClassName 200865.4 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