Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0
Firefox 66
Mac OS X 10.14
Desktop
5 years ago
Test name Executions per second
Vanilla JS - getElementsByClassName() 5100718.0 Ops/sec
Vanilla JS - getElementById() 5060206.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • Vanilla JS - getElementsByClassName()

  • Vanilla JS - getElementById()

  • jQuery class selector - $(".lesson-summary-wrapper");

  • jQuery find in context - $main.find(".lesson-summary-wrapper");

  • jQuery class selector with context - $(".lesson-summary-wrapper", "main");

  • Vanilla JS - querySelector() decendant selector

  • Vanilla JS - by ID (as context) and classname

  • Vanilla JS - querySelectorAll() decendant selector

  • jQuery - Decendant selector

  • jQuery - class selector with context as stored jQuery.Element

  • jQuery - class selector with context as jQuery element selector

  • jQuery - Decendant selector using id and classes

  • jQuery - Decendant selector using classes

  • jQuery - Decendant selector using id and class

  • Vanilla JS - using querySelector(id) + querySelectorAll(class)

  • Vanilla JS - using querySelectorAll()


;