jQuery create vs clone
JavaScript performance comparison
Info
Performance of cloning vs creating new elements with html string
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
$.testElemStr = '<div class="ui-resizable-iframefix" style="background: #fff;"></div>';
$.testElem = $($.testElemStr);
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
create from string literal |
|
pending… |
create from string var |
|
pending… |
create via jQuery.clone |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments