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() 4846365.5 Ops/sec
Vanilla JS - getElementById() 4870160.0 Ops/sec
jQuery class selector - $(".lesson-summary-wrapper"); 403123.2 Ops/sec
jQuery find in context - $main.find(".lesson-summary-wrapper"); 417799.9 Ops/sec
jQuery class selector with context - $(".lesson-summary-wrapper", "main"); 183823.5 Ops/sec
Vanilla JS - querySelector() decendant selector 1631196.2 Ops/sec
Vanilla JS - by ID (as context) and classname 2242405.8 Ops/sec
Vanilla JS - querySelectorAll() decendant selector 711276.1 Ops/sec
jQuery - Decendant selector 229936.2 Ops/sec
jQuery - class selector with context as stored jQuery.Element 340423.9 Ops/sec
jQuery - class selector with context as jQuery element selector 175167.7 Ops/sec
jQuery - Decendant selector using id and classes 217064.4 Ops/sec
jQuery - Decendant selector using classes 228555.1 Ops/sec
jQuery - Decendant selector using id and class 219830.6 Ops/sec
Vanilla JS - using querySelector(id) + querySelectorAll(class) 937385.6 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()


;