by kc8ual » 2008-01-02 09:08 am
Just to give a little insight into the tricks... well not actually a trick at all... that I did which greatly reduced the bandwidth my topsite has used and will use.
I am always a big supporter of well documented scripts. I always will be, but you can drastically reduce the amount of bytes of data that needs to load, by simply going through each file and removing the "//comments".
But it also important to stress to you, that by removing the comments, it will make locating some of the code on a file harder, if not next to impossible. My suggestion, is for each *.php file that you will remove the "//comments" from, to keep a *txt file of the same name. For each comment, copy it into the *.txt file and assign it a number, then in the *.php file, replace the "//comment" with "//the number you assigned" eg "//1" this way, if you ever have to go back, you can simply open up button.txt and button.php at the same time, and use the button.txt as a "legend" or a key of sorts to help you. I have lowered button.php to 3.56 KB and captcha.php to 4.97 KB.
Then make sure to keep those text file safe. I have cut the size of the website code down ~43% this way.
Remember, it is important to keep these comments available to you, but not necessarily on the *.php file itself. Every time the page loads and it has to call the other php scripts, it loads the scripts... and the comments before returning the results as HTML. Some of these scripts that may be called more often than others can seriously cut down on your monthly bandwidth usage.