I have a aspx page which contains 6 user controls which will be displayed when the user clicks on any button using show model pop up extender. My page rendering takes more time. it taked 3 minuits to load the page. If i debug the page its traveling to page load of all the user controls.
Its not taking more time to fetch the data from database but its taking time to load the page. Is there any way to improve the perfomace .
Is there any place where i have to look into.
I am using VS 2010 and c# . Please 开发者_JAVA百科let me know if you have any questions.
Regards, Jebli.
This might be page rendering performance problem or something else. For example, if you have some large loop of dynamically rendered controls (in a repeater, grid, ..) and you accessing the db for couple of easy queries each iteration, it may take much more time than you guess.
Because I never heard that simple control rendering process takes much of time.
So the best way to optimize the code is a line-by-line analysis by using code profiler. Take a look on some of these:
- XteProfiler is free
- dotTrace gives 30 days for trial, good one
- ANTS Profiler yet another profiler
By using a profiler you can find what parts of code gives a performance problems
Other than the third party profilers you can actully use the VS2010 profiler too. MS has done a good job on this one.
As a regular coding practise you can check the following points to optimse the page performace:
Avoid fetching full tables from DB, fetch only what you need to display and have some paging mechanism to display rest of the info.
Cache whatever data you can, set sliding expiration if neccessary.
Try using HtmlControls with runat="server", if you can.
As of now, this is what I can think of, from the top of my head. Would add more as and when I can.
精彩评论