jQuery element creation

JavaScript performance comparison

Revision 17 of this test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
Benchmark.prototype.setup = function() {
    var make = function (type) {
        return $(document.createElement(type));
    };
   
    var eles = {
        div : make('div'),
        span : make('div')
    }
   
    var make2 = function (type) {
        return eles[type].clone();
    }
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
basic jQuery
$('<div/>');
pending…
Wrapped document.createElement
make('div')
pending…
Precached element cloning
make2('div')
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