cloneNode vs createElement Performance

JavaScript performance comparison

Revision 13 of this test case created by dsfdsfdsf

Preparation code

<script>
  var boh = document.createElement("_");

  var row = document.createElement("row");

  var img = document.createElement("img");
  
  var div = document.createElement("div");
  
  var input = document.createElement("input");

  var frag = document.createDocumentFragment();

  frag.appendChild(div)
</script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
clone image
var imgClone = img.cloneNode(false);
pending…
create image
var img_ = document.createElement("img");
pending…
clone div
var divClone = div.cloneNode(false);
pending…
create div
var div_ = document.createElement("div");
pending…
clone input
var inputClone = input.cloneNode(false);
pending…
create input
var input_ = document.createElement("input");
pending…
new image
var img2 = new Image();
pending…
frag clone
var divFragghed = (frag.cloneNode(true)).firstChild
pending…
create boh
var boh_ = document.createElement("_")
pending…
clone boh
var bohClone = boh.cloneNode(false)
pending…
create row
var row_ = document.createElement("row")
pending…
clone row
var rowClone = row.cloneNode(false)
pending…

Compare results of other browsers

Revisions

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

0 Comments