Added to Website Resources on August 18, 2008
2,231 Views
Website Optimization And Speed
Here are tips on how to make your site faster!
1. GZip
At the top of every page, put the following code:
<? ob_start("ob_gzhandler"); ?>
This compresses all the data that your browser is receiving before displaying it so that it can travel from the server to you faster! This also saves bandwidth for your site.
2. Javascript and Ajax
Use javascript and ajax only when necessary, don't overdo it! There are so many sites that have unnecessary ajax animations or worthless parts that are loaded with ajax. Javascript files can be big, and there are so many other solutions to the things people use with javascript.
3. Images, Included Files and HTTP Requests.
This is the BIGGEST one of them all. The more images, outside files and css stylesheets you have connected with a page, the slower the page will go. Take your time to minimize and optimize file sizes for these files and images to make them load faster. Every time an image or file is requested for the page, then a HTTP Request is made, which really slows down loading times. Compress your javascript, html and css stylesheets using the following:
HTML Pages: Use GZip. Look at step one.
Javascript: http://www.fmarcia.info/jsmin/test.html - This site will minimize your javascript and really reduce the file size.
CSS: http://www.cssdrive.com/index.php/main/csscompressor/ - This site will do the same thing for your CSS files.
4. Limiting MySQL Queries.
Every time your make a query to your mysql databases, your loading time increases slightly. This can be hard for web developers to do this, but whenever you can use the same query for something, do so. Also, when selecting information from databases, do the following:
Instead of writing:
SELECT * FROM database
Write the following:
SELECT id, name, date, author, etc, blah, blah FROM database
This takes less time and server load.
5. Renaming Files' Extensions to .PHP
Some people say that saving your javascript files and css files as filename.js.php or stylesheet.css.php with the .PHP at the end will make the loading times faster, but I haven't really noticed any difference. You can try it if worse comes to worse. You will of course, have to include the file using php for any page you want to use it on.
6. http://www.websiteoptimization.com/
Go to this page, http://www.websiteoptimization.com/services/analyze/wso.php, and analyze your own web pages. It will give you advice on what you should do to make your pages faster. I always use it when making new pages.