PDA

View Full Version : Eliminating HTML comments to improve download speed



dophinsluv
04-12-2008, 10:24 AM
What's the best way to eliminate HTML comments to improve download speed?

What do you think of this technique?

Instead of doing this:


<!--
// This is a comment that is downloaded to the user's browser
-->


do this:


<?php
// This is a comment that is not downloaded to the users browser
?>


What other techniques are people using to improve download speed?

bobdog
04-12-2008, 11:03 AM
A few comments in the source code won't slow things too much.

Slow sites are generally because of large images or poorly written php scripts. Be sure to optimize your images that will speed things up.

felgall
04-12-2008, 02:17 PM
If the page is static HTML then making it HTML rather than PHP would probably have more of an impact on the speed of delivery than not sending the comment.

dophinsluv
04-13-2008, 10:11 AM
Great feedback!

What do you think the biggest issues are with php performance? Do you have any helpful hints?

felgall
04-13-2008, 01:32 PM
There is no issue that I know of specifically regarding PHP performance except that it does take time to run the page source through the PHP parser and so if you don't need PHP in the page then you can save that execution time by not feeding the HTML through that step. That would save a small amount of time for every visitor while the amount of time saved by not having the comment in the HTML will be smaller than that except for people on the slowest internet connections.