Test scroll table

JavaScript performance comparison

Test case created

Preparation code

<div style="height:100px; overflow:scroll" id="scrollDiv">
<table id="scrolltable">
</table>
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
Benchmark.prototype.setup = function() {
    for (var i = 0; i < 10000; i++) {
      var tr = $('<tr>');
      var td1 = $('<td>');
      tr.append(td1);
      td1.text('aaaaa');
      var td2 = $('<td>');
      tr.append(td2);
      td2.text('bbbbb');
      var td3 = $('<td>');
      tr.append(td3);
      td3.text('ccccc');
      $('#scrolltable').append(tr);
    }
    var tableheight = $('#scrolltable').height()
};
</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
Scroll Bottom Scroll Top
$('#scrollDiv').scrollTop(tableheight);
$('#scrollDiv').scrollTop(0);
pending…
Scroll Bottom Scroll Top
$('#scrollDiv').get(0).scrollTop = tableheight;
$('#scrollDiv').get(0).scrollTop = 0;
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