sflsjflksdjkflj

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var parent = document.createElement('div');
    document.body.appendChild(parent);
   
    function makeNewChildren() {
        var arr = [], el;
        for (var i = 0; i < 10; i++) {
            el = document.createElement('div');
            el.innerHTML = '' + Math.random();
            arr.push(el);
        }
        return arr;
    }
};

Benchmark.prototype.teardown = function() {
    parent.innerHTML = '';
};
</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
unbuffered
var newChildren = makeNewChildren();
for (var i = 0; i < newChildren.length; i++) {
    parent.appendChild(newChildren[i]);
}
pending…
buffered
var newChildren = makeNewChildren(),
    buffer = document.createDocumentFragment();
for (var i = 0; i < newChildren.length; i++) {
    buffer.appendChild(newChildren[i]);
}
parent.appendChild(buffer);
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment