Vanilla JS, Cash and jQuery - GetID Speed Test

8 years ago
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Test name Executions per second
jQuery 3.1.1 Slim 509860.8 Ops/sec
Vanilla JS 1020565.4 Ops/sec
jQuery 3.1.1 Slim + Vanilla JS 589303.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

Open this result on MeasureThat.net