documentFragment appendChild vs jquery append
JavaScript performance comparison
Preparation code
<div id="test-area" style="height: 75px; width: auto; overflow:scroll">
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var test_area = document.getElementById('test-area');
var $test_area = $(test_area);
};
Benchmark.prototype.teardown = function() {
$test_area.empty();
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
insert document fragment |
|
pending… |
direct insert |
|
pending… |
jQuery insert div |
|
pending… |
jQuery direct insert |
|
pending… |
jQuery direct insert & raw create |
|
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:
- Revision 1: published
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 8: published by cazhfe
- Revision 9: published
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 14: published by Rod Knowlton
- Revision 15: published by Rod Knowlton
- Revision 16: published
- Revision 17: published
- Revision 21: published by Mario
- Revision 22: published by Mario Estrada
- Revision 24: published
- Revision 26: published by Ted Ying
0 comments