cloneNode vs createElement

JavaScript performance comparison

Revision 3 of this test case created by Rhys Brett-Bowen

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></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 a = document.createElement('div');
var b = a.cloneNode(false);
var c = a.cloneNode(false);
var d = a.cloneNode(false);
var e = a.cloneNode(false);
var f = a.cloneNode(false);
pending…
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');
pending…
jQuery Clone
var a = $('<div />');
var b = a.clone();
var c = a.clone();
var d = a.clone();
var e = a.clone();
var f = a.clone();
pending…
jQuery Create
var a = $('<div />');
var b = $('<div />');
var c = $('<div />');
var d = $('<div />');
var e = $('<div />');
var f = $('<div />');
pending…
cloneNode deep
var a = document.createElement('div');
var b = a.cloneNode(true);
var c = a.cloneNode(true);
var d = a.cloneNode(true);
var e = a.cloneNode(true);
var f = a.cloneNode(true);
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. Here’s a list of current revisions for this page:

0 comments

Add a comment