Dom R & W

JavaScript performance comparison

Test case created

Info

Test case Reading and Writing in to the Dom

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style>

#snail {
    background: red;
    width: 10px;
    height: 30px;
}
</style>
<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);
};
pending…
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);
};
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