Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Chrome 56
Windows 7
Other
7 years ago
Test name Executions per second
1 div with javascript 1073251.4 Ops/sec
1 div with jquery selector 1085326.8 Ops/sec
2 divs with javascript. Add with jquery 170913.4 Ops/sec
2 divs with 2 jquery selectors. Add with jquery 156218.0 Ops/sec
2 divs with javascript. Add with array 517919.6 Ops/sec
2 divs with 2 jquery selectors. Add with array 333339.6 Ops/sec
2 divs with single jquery selector 363.4 Ops/sec
1 div with jquery selector with context 370011.0 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