append vs appendTo (v3)

Revision 3 of this benchmark created by LJHarb on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
append
var $input = $('<input/>', { type: 'hidden', disabled: true, value: 1, name: 'name' });
var $label = $('<div/>', { html:'html' }); 

var $activatedItem = $('<li/>', {
  "class": 'activatedItem'
});
$activatedItem.append($input);
$activatedItem.append($label);
$activatedItem.append($('<div/>', {
  "class": 'class_deactivate'
})
);
ready
appendTo
var $input = $('<input/>', { type: 'hidden', disabled: true, value: 1, name: 'name' });
var $label = $('<div/>', { html:'html' }); 

var $activatedItem = $('<li/>', {
  "class": 'activatedItem'
});
var $mydiv = $('<div/>', {
  "class": 'class_deactivate'
});
$input.appendTo($activatedItem);
$label.appendTo($activatedItem);
$mydiv.appendTo($activatedItem);
ready

Revisions

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