Wednesday, 22 June 2011

Site Performance Aspects


  1. Avoid Inline JavaScript.
  2. When scripts are defined on top of the page they can take unnecessary time to load. It's better to display the HTML contents of a page, and then load any scripting code.
  3. Avoid Inline CSS.
  4. .css files are normally cached by browsers, so a single and heavy .css file doesn’t cause a long wait on each page request.
  5. Check “Page.IsPostBack”. To avoid repetition code execution.
  6. Avoid hard coding (Session name, ViewState name etc.).
  7. Use Exception handling.
  8. Use strString=string.Empty instead of strString="" or strString=null.
  9. Convert Window into Div.
  10. If page is required to be fetched every time from web server then explicitly disable page caching. Use caching and Page output wherever possible.
  11. Code optimization:  Avoid using code like x = x +1; it is always better to use x+=1.
  12. Use Cache appropriately.
  13. Deploying Production Code in Release Mode (set <compilation debug="false" /> in web.config).
  14. Static contents should be cached, like “Contact us” and “About us” pages, and such other pages which contain static information.
  15. Remove unused HttpModules. 
  16. Reduce page size by removing any unnecessary space and tab characters from the page. As a result network traffic will be reduced.

No comments:

Post a Comment