One question that asked by most programmers' is how to optimize their code.How to improve the performance of their overall project.I am gonna discuss the optimization issues with various languages one by one starting from asp.net.
There are some points that will help you to improve the overall performance of your asp.net coding.
- Page.IsPostback - Page.IsPostback gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a post back. Rather than loading all the components each time page rendered, you can use this method to load only desirable components .So use Page.IsPostback to avoid unnecessary processing on a round trip.
- Cache Data: As I have already told you in my previous post, the client side caching is a way to cache the images and data on the client side browser or computer. Using caching helps improve the performance by reducing the overall load on the server. This is because the resources that do not change frequently are cached and are not requested by the client again and again.CACHE data and page output whenever possible.
- View State: ASP.NET view state, is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks. Turn OFF ViewState if not being used. Ihe ViewState is configured at three levels which results in slow performance of the application,when it is Turned ON.Refer http://msdn.microsoft.com/en-us/library/ms972976.aspx for more detail about view state.
- Session: Minimize the amount and complexity of data stored in a session state.
The larger and complex the data is ,the higher the cost of serializing or deserializing of data.Disable the Session when it is not using.This can be done at the application level in the "Machine.Config" file or at a page level.
- SERVER.TRANSFER: Use SERVER.TRANSFER rather than Response.Redirect, if the WebPage is present in the same application. This makes the communication faster.
- Debug: Disable DEBUG mode before deploying the application.
- PRE-BATCH" compilation: Do a “PRE-BATCH" compilation.
To achieve this, request a page from the site. Avoid making changes to pages or assemblies that are there in the bin directory of the application. A changed page will only recompile the page. Any change to the bin directory will result in recompile of the entire application.
- Use TRACE : Use ASP.NET TRACE feature for efficient debugging instead of RESPONSE.WRITE.
- Server Controls : Use Server Controls in appropriate circumstances. Since, they are expensive because they are server resources even though are they are very easy to implement.
- Release Resources: Release the native resources as soon as the usage is over.This will reduce performance issues, since by nature GC release them at a later point.This results in appropriate utilization of resources by the other Requests.
IN-PROC option will provide better performance.
SQL SERVER option provides more reliability
Hope this points will help you.
