With frequently updated content, enhanced richmedia advertising, and third party widgets among many other expansion of features, source code for your website is exploding quickly and without constant optimization effort, the costs (slow loading time, larger bandwidth bills, low user activities) will outweigh the benefits from all the exciting features. High performance websites should be optimized frequently, from designing the first pages to routine maintenances. There are many tips, tricks and techniques you can do to speed up your website. Your users will thank you for saving their time and money.
Aware of the problem
If your site is hosted on the machine next to your desk and not some remote datacenter, you will not see any performance problem. You should know your visitors: connection types (mainly dial-up or all broadband), geographical distribution (how far they are from your web servers, the further away, the slower web pages load). There are tools to simulate different locations and connection speeds. If you have frequent interaction with users, they will let you know through complaints.
Determine what to optimize
Ideally, every page, section should be optimized. However, we all have limited resources and solve the biggest bottleneck will give the most impact. Another strategy is to find a set of simplest optimizations. Remember that optimization is a loop: optimize, measure, then optimize further or choose another area. There are many tools for developers and Firefox is definitely a good friend with useful addons. Firebug with YSlow can generate a performance report card (A is the best, F is the worst).
Identify solutions
A good solution takes into account the trade-offs between speed versus other factors (browser compatibility, file organization, code readability). With an existing site, you want optimizations that do not destroy the existing work processes. In many cases, the end user does not care or read your source code so scramble/obfuscate it all you want but your developers need a well-organized structure to be productive. For simple sites, you can do manual optimization. For large sites, develop systematic/automated scripts so it could be run whenever you update the code. Some optimization techniques that are very basic, simple to implement:
- Turn on compression (mod_gzip, mod_deflate or PHP's ob_start/ob_gzhandler). HTML, JavaScript, CSS, XML files can all be compressed
- Compact CSS code with CSSTidy, JavaScript with DoJo's ShrinkSafe
- Combining CSS stylesheets and JavaScript files into single files
Was this information helpful?
Yes /
No