Performance is the prime factor in the development of all type of applications. It becomes extremely important for a web application. Here are some guidelines for improving the application performance.
On the ASp.net Side
- Viewstate dramatically increase page size so use viewstate for controls carefully.
- Use static or shared variable instead of application variable.
- Use AJAX where ever possible.
- Avoid writing inline code.
- Use server.tranfer instead of response.redirect whenever possible.
- Avoid using datagrid. Use repeater and datalist where ever possible.
- Avoid use of a Throw to control the application flow: As it is an expensive operation, it should be used only when the execution must be stopped.
- Avoid overuse of exception handling block: Do not place try's in everywhere in the code. Put just in places where you can't have control
- Avoid huge methods: It is preferably small ones, which do just one single purpose. Huge methods, doing so many things tend to get even bigger, and the code tends to become slower for every maintenance.
- Datasets are too costly. when using them; try to fetch max data in dataset once and then consume this dataset.
- As everyone know, use stored procedure instead of writing long text queries. Stored procedures use compiled execution, are stored permanently on the back-end thus executes dramatically faster than text queries. When your SQL Server is located on another server and accessed over a network, stored procedures can help you to reduce network taffic as simple data elements are passed through the backend rather thang long text queries.
- Never name your stored procedure with the prefix sp_. This prefix is internal to Microsoft SQL Server for looking for sp's in master db, so when you name your sp with sp_ firstly, the server will look for it in master table.
- Avoid SELECT * FROM TABLE: This generate an internal select on syscolumns to determine which columns is going to be returned. Instead specify individual column names.
- If possible, avoid table scans Try to insert at least an index for every table.
EdwineditedPosted Jul 5, 2006, 8:04 PMEdited Nov 24, 2006, 2:36 AM
ASP.Net always use Viewstate to retrieve value isn't it. If you disable viewstate how the code behind could retrieve values from rendered HTML controls? Also for Excel Like Form (Multi Rows Entry) how to optimize that form from viewstate. It could become really really huge.
gary.thickettPosted Jun 30, 2006, 5:12 AM
Stored procedures use compiled execution and executes dramatically faster than text queries. This statement is wrong t-sql is also compiled check books online it's in there