DOM operations comparison

JavaScript performance comparison

Test case created by Marcin

Preparation code

<div id="test">Hello World!</div>

<style>
.active {
  font-weight: bold;
}
</style>
 
<script>
Benchmark.prototype.setup = function() {
    var DIV = document.getElementById('test');
};
</script>

Preparation code output

Hello World!

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
className
DIV.className = 'active';
DIV.className += ' ';
pending…
innerHTML
DIV.innerHTML = 'Hello World!';
DIV.innerHTML += ' ';
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