Here are some of the most common speed optimization methods I follow when I’m developing a new project.
- Cache data and images whenever possible to avoid database querying and unnecessary requests.
- Load iframes dynamically trough JS as they affect the onload event of the web page.
- Resize images trough the back-end administration area, or use a handler to resize images on the fly.
- Minify / obfuscate all CSS and JS files.
- Bundle all CSS and JS files into a single file to avoid multiple file requests to the server.
- Remove unnecessary / unused fields from SELECT statements in database. Example: specify field names instead of using the * symbol.
- Avoid database round trips to load page content. If possible call one SP with multiple result sets.
- Load content dynamically with AJAX so page loads up faster. (Partial page loading) Note: Avoid using the standard ASP.Net AJAX update panels as they add a lot of overhead, instead use jQuery directly to call ASP.NET AJAX page methods)
- Create paging at server side in SQL and call pages trough ajax instead of loading all content at once from the database and paging trough it.
- Put all java script code at the bottom of the page. This will allow the page content to load first since browsers load the page sequentially.
- Index database tables where necessary.
- Remove the default ASP.Net viewstate if not being used as this adds a lot on the page size.
I will be updating this list as time goes by. If any one of you out there has other common useful methods please post them in the comments below.