Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.89 Safari/537.36
Chrome 53
Windows
Other
8 years ago
Test name Executions per second
Fetch 1 div with javascript 1721739.4 Ops/sec
Fetch 2 divs with javascript 987959.6 Ops/sec
Fetch 1 div with jquery selector 1833361.4 Ops/sec
Fetch 2 divs with jquery selector 540.8 Ops/sec
Fetch 2 divs with 2 jquery selectors 1782844.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