fusu

JavaScript performance comparison

Test case created by Arkadiusz

Preparation code

<p id="foo">Foo</p>
<p id="bar">Bar</p>
<p id="baz">Baz</p>
    

Preparation code output

<p id="foo">Foo</p> <p id="bar">Bar</p> <p id="baz">Baz</p>

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
clear
var divForTasks = document.getElementById(`foo`);

	for (var i = 0; i <= 99; i += 1) {
		var creatingImg = document.createElement("img"),
			creatingTask = document.createElement("div"),
			creatingAmountSpan = document.createElement("span"),
			creatingActualSpan = document.createElement("span");

		creatingImg.className = "img-responsive no-padding";
		creatingTask.className = "no-padding text-center pull-left";
		creatingTask.style.borderRadius = '40px';
		creatingImg.style.height = `28px`;
		creatingImg.style.margin = `auto`;
		creatingActualSpan.innerHTML = '0';

		divForTasks.appendChild(creatingTask);
		creatingTask.appendChild(creatingAmountSpan);
		creatingTask.appendChild(creatingImg);
		creatingTask.appendChild(creatingActualSpan);
	}
divForTasks.innerHTML = '';
pending…
fragmet
var divForTasks = document.getElementById(`foo`),
		fragment = document.createDocumentFragment();

	for (var i = 0; i <= 99; i += 1) {
		var creatingImg = document.createElement("img"),
			creatingTask = document.createElement("div"),
			creatingAmountSpan = document.createElement("span"),
			creatingActualSpan = document.createElement("span");

		creatingImg.className = "img-responsive no-padding";
		creatingTask.className = "no-padding text-center pull-left";
		creatingTask.style.borderRadius = '40px';
		creatingImg.style.height = `28px`;
		creatingImg.style.margin = `auto`;
		creatingActualSpan.innerHTML = '0';

		fragment.appendChild(creatingTask);
		creatingTask.appendChild(creatingAmountSpan);
		creatingTask.appendChild(creatingImg);
		creatingTask.appendChild(creatingActualSpan);
	}
	divForTasks.appendChild(fragment);
divForTasks.innerHTML = '';
pending…

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

0 Comments

Foo

Bar

Baz