jQuery.html() vs jQuery.append() vs jQuery.prepend() (v2)

Revision 2 of this benchmark created on


Preparation HTML

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

Setup

var html = '<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>';
    
    $('body').append($('#test-wrapper'));

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery html
$('#test-wrapper').html(html);
ready
jQuery append
$('#test-wrapper').append($(html));
ready
jQuery prepend
$('#test-wrapper').prepend($(html));
ready

Revisions

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