Thursday, January 10, 2008

Performance Boosting .NET coding tips

Performance Boosting .NET coding tips
# Instantiate Objects only if really needed { will NOT use up memory unnecessarily }
# Prefer using String.Empty instead of "" for string initialisation
# Prefer using StringBuilder for dynamic creation of Strings.
# Avoid String datatype while using Switch Case programming-construct
# Use Server.Transfer() instead of Response.Redirect() method.
# Avoid use of Page.DataBind() method
# Define the four most frequently used local variables as the first four variables.
# Even inside vb.net OR c# code, Avoid using the “select * from table” syntax.
# Use proper column case in queries.dr[“ProductName”] vs dr[“PRODUCTNAME”]
# Use Page.IsPostBack to minimize redundant processing in page load.
# Avoid server round trips (by using client scripts, validator controls, html controls, caching techniques (for pages, user controls and objects)).
# Disable view state on a control-level / page-level if you do not need it.DataGrid with ViewState disabled is 66% faster than DataGrid with ViewState enabled.
# Minimize the number of objects you store in view state.
# Use a DataReader for fast and efficient data binding.
# Prefer to Use try/finally on disposable resources.
# Minimize calls to DataBinder.Eval