开发者

ASP.NET Html table performance on rendering

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?


  1. 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 with StringBuffer).
  2. 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.
  3. 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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜