sScrollY slows down table load by several seconds
sScrollY slows down table load by several seconds
mrashkovsky
Posts: 9Questions: 0Answers: 0
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!
This discussion has been closed.
Replies
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.
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
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.
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