Dom R & W

JavaScript performance comparison

Test case created


Test case Reading and Writing in to the Dom

Preparation code

<script src=""></script>

#snail {
    background: red;
    width: 10px;
    height: 30px;
<div id="snail"></div>

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
reading and writing in the dom
for (var i = 0; i < 5; i++) {
    var w = parseInt($('#snail').css('width'));
    $('#snail').css('width', w + 10);
caching in a variable
var w = 10;
var di = $('#snail');
for (var i = 0; i < 5; i++) {
      var w = w+10;
      di.css('width', w);

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

Compare results of other browsers


Comment form temporarily disabled.

Add a comment