Another DOM thing

JavaScript performance comparison

Test case created by Ryan O'Hara

Preparation code

<div id="test"></div>
<script>
Benchmark.prototype.setup = function() {
    var test = document.getElementById('test');
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
DOM
var link = document.createElement('a');
link.href = 'https://google.ca/';
link.appendChild(document.createTextNode('Click here!'));
if(test.childNodes.length > 0) {
    test.removeChild(test.firstChild);
}
test.appendChild(link);
pending…
innerHTML
test.innerHTML = '<a href="https://google.ca">Click here!</a>';
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