DocumentFragment speed test

JavaScript performance comparison

Test case created by JesmoDrazik

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
With DocumentFragment
var elements = ['Pommes', 'Poires', 'Carottes', 'Tomates'];
var fragment = document.createDocumentFragment();
var title = document.createElement('h1');
var list = document.createElement('ul');
title.innerHTML = 'Ma liste de trucs à acheter';
fragment.appendChild(title);

elements.forEach(function(element) {
    var listItem = document.createElement('li');
    listItem.innerHTML = element;

    list.appendChild(listItem);
});

fragment.appendChild(list);

document.body.appendChild(fragment);
pending…
Without DocumentFragment
var elements = ['Pommes', 'Poires', 'Carottes', 'Tomates'];
var title = document.createElement('h1');
var list = document.createElement('ul');
title.innerHTML = 'Ma liste de trucs à acheter';

elements.forEach(function(element) {
    var listItem = document.createElement('li');
    listItem.innerHTML = element;

    list.appendChild(listItem);
});

document.body.appendChild(title);
document.body.appendChild(list);
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