sScrollY slows down table load by several seconds

sScrollY slows down table load by several seconds

mrashkovskymrashkovsky Posts: 9Questions: 0Answers: 0
edited December 2013 in DataTables 1.9
Hello, I'm just wondering if it's normal for sScrollY to slow down the table load by a few seconds? Including it adds about 4 seconds before the data actually populates my table. Thanks for the great work!

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    It will slow it down a little since it needs to read column width and then set when the table redraws, but 4 seconds sounds very long - I don't think it should be as long as that unless you have a large number of columns. Can you link to the page please.

    Allan
  • mrashkovskymrashkovsky Posts: 9Questions: 0Answers: 0
    Hi Allan,

    Thanks for the response. The backend is actually behind a VPN and the site has never been published on a full web server, so I don't think I can share it in any meaningful way. I did run the datatables debugger if that helps:
    http://debug.datatables.net/okuxeb

    I've also saved some data from Chrome DevTools timeline here: https://www.dropbox.com/sh/t6ijf7k3d4pscf2/zAuO-QNSIB/datatable

    The screenshot shows which event in the timeline takes 4 seconds -- XHR Ready State Change x 10
    You can load the raw data file into chrome dev tools to explore that in detail, though for some reason the times don't get reported accurately anymore and what was one 4 seconds looks like it took milliseconds.
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    Could you possibly try DataTables 1.10 please: https://github.com/DataTables/DataTables/tree/1_10_wip/media/js ? I've got a bunch of modifications in there to try and make things faster, particularly the column alignment when scrolling.

    Just one thing from the debugger:

    > Draws 61

    Had you been redrawing the table a number of times (sorting, paging etc)? Or was that trace taken immediately on start up?

    Allan
  • mrashkovskymrashkovsky Posts: 9Questions: 0Answers: 0
    I hadn't been redrawing the table, that debug was taken immediately on start up.

    However, I was adding 60 rows of data one by one using fnAddData. I just tried pushing them to an array and doing only one call to fnAddData and that cleared the issue right up -- sScrollY works just fine and doesn't slow things down at all!

    I'll give 1.10 a try and see what that does in either case if it helps.
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    > However, I was adding 60 rows of data one by one using fnAddData

    Ouch! Yup - that would do it! Unless to tell fnAddData to not redraw the table, it will redraw it on every call, and adding 60 rows is going to hurt, as you've been seeing!

    The new API in 1.10 specifically required the new `draw()` function to be called to try and overcome this kind of thing, but the new API isn't fully documented yet... :-)

    Allan
  • mrashkovskymrashkovsky Posts: 9Questions: 0Answers: 0
    Great! Thanks Allan. Looking forward to the next release!
This discussion has been closed.