i need to create an html report where i've to put a table into. This table is composed by 265 rows and a variable column number (between 1 and 150+).
Problems start when i try to render a report with 20+ columns: data fetching from db is fast, but rendering the result in the html table is very slow!
I create the report in the code-behind through TableRow/TableCell , by cycling on a List property开发者_如何学编程 of my object. Viewstat is disabled.
any ideas?
- Changing to manipulating strings yourself isn't the nicest optimisation, but it may be worth it here. If you do so, do many small
Response.Write
operations, rather than large string operations (even withStringBuffer
). - Call flush reasonably regularly. Too often loses the performance gain of buffering, too seldom causes the entire response to wait in memory (with growing memory pressure) before the first octet can be used by the browser, experiment with calling
Response.Flush
every x rows with different values of x to find a good balance. - If you can, break the table into separate tables (easy if fixed-width, generally nasty otherwise) as this will improve the actual rendering on the browser. Use of
table-layout: fixed;
in the CSS can also help here.
精彩评论