Vanilla JS innerHTML vs jQuery html()

Benchmark created by André Ruffert on


Preparation HTML

<div id="js-element">initial content</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var element = document.getElementById('js-element');

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
element.innerHTML = 'new content';
ready
jQuery html()
$(element).html('new content');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by André Ruffert on
  • Revision 3: published by Martín Acosta on
  • Revision 4: published on
  • Revision 5: published by Ben on
  • Revision 6: published by Andrew on
  • Revision 7: published by Andrew on