Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.35 sec)
Whitespace gzip compression and Apache

Does removing comments and whitespace from my PHP code actually make much difference in page load times due the file size ?

I've checked Apache is gzipping the content.
Asked by:
TomPating
1355 points
 Report Abuse
 Share Page - Category: Programming - Tags: Whitespace gzip compression and Apache
 Enter your response
Please use Pastie.org to paste lengthy code or to fix formatting issues with code
  • Responses in reverse (1)

Best Answer

In theory it might, but for most servers it's likely to be absolutely microscopic unless you've got huge scripts.

One of the best ways to speed up a PHP script is to compile the code with something like Eaccelerator or similar which compiles the script and keeps a cache of it, thus PHP doesn't have to compile it everytime it runs. This does have a few problems like often needing to restart Apache when you change a script or waiting for say Eaccelerator to update to the next version of PHP.

As for Gzip, that only kicks in when the PHP script has run and the output is being sent to the browser. If the browser says it supports Gzip then the output will be compressed and uncompressed at the far end. It has no effect on the actual PHP script run time or removing any comments etc. from it.

http://eaccelerator.net/


Response by:
trevHCS
640 points


  • Related Questions
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle