function benchmark(fn, i) {
var t = new Date().getTime()
while(i--) fn();
return new Date().getTime() - t;
};
function testA() {
var d = document, x = d.createElement('div'), j = 1000, n;
while(j--) {
x = x.appendChild(d.createElement('div'));
};
};
function testB() {
var d = document, x = d.createElement('div'), j = 1000, n;
while(j--) {
n = d.createElement('div');
n.appendChild(x);
x = n;
};
};
function testC() {
var x = document.createElement('div');
var html = '', j = 1000, i;
for(i = j; i--;) html += '<div>';
for(i = j; i--;) html += '</div>';
x.innerHTML = html;
};
var A = benchmark(testA, 10);
var B = benchmark(testB, 10); // IE
var C = benchmark(testC, 10); // Google Chrome 17 dev
alert('testA - ' + A + 'mc, testB - ' + B + 'mc, testC - ' + C + 'mc');