cloneNode vs createElement

JavaScript performance comparison

Revision 2 of this test case created by The Able Few

Preparation code

<script src=""></script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
JS Clone
var tmp = document.createElement('div');
var a = tmp.cloneNode();
var b = tmp.cloneNode();
var c = tmp.cloneNode();
var d = tmp.cloneNode();
var e = tmp.cloneNode();
var f = tmp.cloneNode();
JS Create
var a = document.createElement('div');
var b = document.createElement('div');
var c = document.createElement('div');
var d = document.createElement('div');
var e = document.createElement('div');
var f = document.createElement('div');
jQuery Clone
var tmp = $('<div />');
var a = tmp.clone();
var b = tmp.clone();
var c = tmp.clone();
var d = tmp.clone();
var e = tmp.clone();
var f = tmp.clone();
jQuery Create
var a = $('<div />');
var b = $('<div />');
var c = $('<div />');
var d = $('<div />');
var e = $('<div />');
var f = $('<div />');

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment