Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36
Chrome 54
Windows
Other
8 years ago
Test name Executions per second
jQuery 569.8 Ops/sec
pure JS 1176.6 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Script Preparation code:
 
var frag = document.createDocumentFragment();
for (var i=0; i<100; i++){
  var inDiv = document.createElement('span');
  inDiv.id="s_"+i;
  inDiv.innerHTML = 'bla';
  inDiv.className = 'myclass';
  frag.appendChild(inDiv);
}
document.body.appendChild(frag);
Tests:
  • jQuery

     
    $('span.myclass').each(function () {
      $(this).html('x');
    });
  • pure JS

     
    $('span.myclass').each(function () {
      this.innerHTML = 'y';
    });