jquery - empty then html vs html (v26)

Revision 26 of this benchmark created on


Description

use empty first then add elements to html vs just use html to do add elements

Preparation HTML

<script src="https://code.jquery.com/jquery-2.1.0.min.js"></script>
<div id="foo">foo bar foo bar foo bar foo bar</div>
<script>
  var foo = $('#foo');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
empty then html
foo.empty().html("abc def ghi jkl");
ready
html
foo.html("abc def ghi jkl");
ready

Revisions

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