Answer the question
In order to leave comments, you need to log in
How to speed up the loading of a large HTML table?
There is an HTML page weighing 4.5 MB, it consists of an HTML table of 2000 lines.
The HTML source is rendered in 250ms (data according to curl).
The JavaScript at the very end of the page is only executed 4 seconds after the page starts loading.
There is no other JavaScript in the code, no CSS, fonts, or other external resources.
How can I reduce these 4 seconds to milliseconds?
Is it enough to replace TABLE with DIVs with display "table-cell" or "flex-box"? In principle, if this speeds up house building, I can set the height of each cell.
You can, of course, load the table gradually with JavaScript, but for now, I would like to avoid JS, to optimize browser rendering.
Answer the question
In order to leave comments, you need to log in
First, go to Web Developer Tools in a browser. For example, for Firefox, this is in the "Web Developer / Network" menu
And see what exactly is slowing down. If it is the download that slows down, then check whether the server is returning compressed data (if nginx, then gzip on is enabled).
The best solution is always post-loading (outputting) data. Just give the frame to the user, and then, when fully loaded, load the content. It's not particularly difficult.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question