Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.8.9 Safari/538.1
Safari
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 4970674.5 Ops/sec
getElementsByClassName() 4152815.8 Ops/sec
getElementsByTagName() 4082044.8 Ops/sec
querySelector(#id) 2552883.5 Ops/sec
querySelector(.id) 2929500.0 Ops/sec
querySelectorAll(#id) 1492723.8 Ops/sec
querySelectorAll(.id) 1562464.2 Ops/sec
jQuery(#id) 1195432.2 Ops/sec
jQuery(.id) 638278.7 Ops/sec
jQuery(tag#id) 513662.9 Ops/sec
jQuery(tag.id) 520525.4 Ops/sec
jQuery + getElementById 2285077.5 Ops/sec
jQuery + getElementsByClassName 1167159.9 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