Jquery Datatable very slow on IE7

Jquery Datatable very slow on IE7

selmantayyarselmantayyar Posts: 1Questions: 0Answers: 0
edited May 2012 in General
Hi,thanks for this great plug-in.

i have some problems using DT on IE and i asked this question on stackoverflow.

http://stackoverflow.com/questions/10431038/jquery-datatable-very-slow-on-ie7

Can you please have a look?

Cheers!

Replies

  • smallvaluesof2smallvaluesof2 Posts: 6Questions: 0Answers: 0
    I love DataTables, great work!

    I too have found very slow table creation on IE7/IE8 relative to Chrome/Firefox 13 (see below).

    My question is really about expectations:

    - should I expect IE7/IE8 to be over 100 times slower than Chrome/Firefox13 when creating
    a reasonably small table (seems crazy, but lots of horror stories on google, some may be true).
    - is there some mitigation around table creation for IE7/IE8 I don't know about (I don't know any,
    so the bar is low on that one)
    - more likely to be something badly wrong at my end that Firefox13/Chrome does not punish but IE does.

    Thanks in advance for any advice or observations

    My tests

    I repeatedly timed the creation of a data table in a number of browsers, all bar IE7 on the same PC.
    I used a stopwatch which I started as I clicked on an alert that preceded the call to create the table
    (javascript based timings proved unreliable in IE due to the high CPU load during table creation).

    The table had 1500 rows ,31 columns, no nulls or undefined in data, sorting disabled, no special renderer or other callbacks, column types defined as string and aaData pre-populated before table creation. No explicit event handling was attached to the table.

    Used jquery 1.7.1 and dataTables 1.9.1.
    Table created in a visible div.

    Firefox 13/Chrome: approx 1 second.
    IE8 in standards mode: approx 200 seconds, 100% CPU during creation.
    IE7: approx 600 seconds, 100% CPU during creation.
    (you can see why a manual stopwatch was good enough).

    I ran a profiler in IE8 which showed the bulk of time being spent in _fnAddData and _fnCreateTr.
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Can you please give us a link so we can see what might be happening.

    Allan
  • smallvaluesof2smallvaluesof2 Posts: 6Questions: 0Answers: 0
    Here is a debug,databables.net code: izapar.

    That upload was from a chrome browser - in IE8, the debugger upload fails under heavy CPU load.

    I really appreciate the help, thanks.
  • smallvaluesof2smallvaluesof2 Posts: 6Questions: 0Answers: 0
    Update: I found that setting "bDeferRender": true helped quite a lot:

    IE7: from 600 secs to 30 secs
    IE8: from 200 secs to 5 secs.

    The page size was 10 rows.
    There was still 100% CPU for duration of table creation.
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    You've got a huge amount of hidden columns. That's going to be wasting a lot of time in IE creating notes that aren't used. Or do you have a UI control to make them visible in future?

    Allan
  • smallvaluesof2smallvaluesof2 Posts: 6Questions: 0Answers: 0
    Yes, there are 32 columns of which a small number are visible by default. A user can easily change which columns are visible and see them appear/disappear dynamically in the table. It's a great feature in DataTables that our (non-IE) users love.

    If it made a big difference, I could probably force a maximum of (say) 12 columns and update column data when a user selects a set of columns that includes columns not in the default set (I believe it is possible to search outside the table content so it should work more or less the same from the user's point of view provided the delays are acceptable).

    The main question for me is if IE7 is "naturally" ++much slower than firefox etc and I should work around it or if I am just using DataTables the wrong way for the IE7 environment (at some level these alternatives overlap, but the emphasis is different).

    Thanks, again
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    > The main question for me is if IE7 is "naturally" ++much slower than firefox

    Hah - yes. Here is Microsoft's own measurements for IE9 (keep in mind that this is more than a year ago, so Firefox etc will have improved since then): http://ie.microsoft.com/testdrive/benchmarks/sunspider/default.html . Note that they show the comparison to IE8 - not IE7. IE7 is probably an order of magnitude slower than IE8 - so way off that scale!

    Allan
  • smallvaluesof2smallvaluesof2 Posts: 6Questions: 0Answers: 0
    Ok, so my main problem is that IE7 is quite slow relative to IE8 and both are very slow compared to Firefox13/Chrome etc rather than I am using using DataTables in very wrong ways. Well, that conclusion stops me chasing rainbows and lets me focus on pragmatic workarounds like the two mentioned above. Thankfully I have a copy of "Designing and Engineering Time" ISBN 978-0321-50918-5 ;-)

    Thanks very much for the help.
  • smallvaluesof2smallvaluesof2 Posts: 6Questions: 0Answers: 0
    One final note. I installed the Google Chrome Frame plugin on IE7 and re-ran my tests:

    Without the plugin:

    IE7: bDeferRender: false, 600 secs
    IE7: bDeferRender: true, 30 secs
    There was still 100% CPU for duration of table creation.

    With the plugin:

    IE7: bDeferRender: false, about 2 secs
    IE7: bDeferRender: true, about 1 sec
    Table creation too short to notice any heavy CPU utilization.

    As an added bonus, bits of my site that broke under IE7 work again.

    Details about Google Chrome Frame:

    https://developers.google.com/chrome/chrome-frame/
  • jamovjamov Posts: 5Questions: 0Answers: 0
    Wow, this helped me indeed.. Thanks for the details!
This discussion has been closed.