Speeding up Datatables — is a 9 second load time reasonable?
Speeding up Datatables — is a 9 second load time reasonable?
Hi guys,
I would like to avoid another generic "how to speed up DT" question, so I'll be as specific as possible.
My DT has ~5000 rows and takes 9 seconds to load with a basic broadband connection. That's mostly because of the 5mb JSON file behind it.
I find this fast in my own typical use, but when I've shown it others, they became impatient, even if later load times (searching) are negligible.
Is there a good way to make the initial load time faster?
I read a few threads about server-side processing and they seem to involve SQL, which is an extra layer of complication for me. All I think I need in that situation is simply a PHP that processes the ajax calls and passes the data from JSON (also protecting it in the process from being saved in the clientes — bonus points).
What is everyone else doing?
Thanks
This question has an accepted answers - jump to answer
Answers
This FAQ discusses the options to help improve the speed to display the table. A quick thing to try is
deferRender
. If most of the delay is due to network latency then deferRender may not help much which leaves the option ofServerSide
processing.With serverSide processing your server script is now responsible querying your data and applying the sorting and searching to return only the rows for the current page being displayed. Your script will need to support the protocol described here:
https://datatables.net/manual/server-side
Kevin
Thank you. I do have deferRender on.
My loading times go from 10 seconds to a whole minute, depending on connection speed.
Correct me if I'm wrong: using SSP, my script will serve as middleman, only returning the first 50 rows in the first load, or as many as the subsequent searches return?