Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Firefox 55
Windows 7
Other
7 years ago
Test name Executions per second
1 div with javascript 1376964.9 Ops/sec
1 div with jquery selector 1794027.4 Ops/sec
2 divs with javascript. Add with jquery 195271.8 Ops/sec
2 divs with 2 jquery selectors. Add with jquery 218266.8 Ops/sec
2 divs with javascript. Add with array 438912.1 Ops/sec
2 divs with 2 jquery selectors. Add with array 468987.9 Ops/sec
2 divs with single jquery selector 400.6 Ops/sec
1 div with jquery selector with context 291510.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • 1 div with javascript

  • 1 div with jquery selector

  • 2 divs with javascript. Add with jquery

  • 2 divs with 2 jquery selectors. Add with jquery

  • 2 divs with javascript. Add with array

  • 2 divs with 2 jquery selectors. Add with array

  • 2 divs with single jquery selector

  • 1 div with jquery selector with context