cloneNode vs createElement Performance (v27)

Revision 27 of this benchmark created on


Description

check speeds with different elements

Preparation HTML

<script>
  var img = document.createElement("img");
  img.src = "http://www.google.com/intl/en_com/images/srpr/logo2w.png";
  
  var div = document.createElement("div");
  
  var input = document.createElement("input");
  input.type = "checkbox";
  input.class = "myinputclass";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
clone image
var imgClone = img.cloneNode(false);
ready
create image
var img = document.createElement("img");
img.src = "http://www.google.com/intl/en_com/images/srpr/logo2w.png";
 
ready
clone div
var divClone = div.cloneNode(false);
ready
create div
var div = document.createElement("div");
 
ready
clone input
var inputClone = input.cloneNode(false);
ready
create input
var input = document.createElement("input");
input.type = "checkbox";
input.class = "myinputclass";
ready

Revisions

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