Possible Duplicate:
How to minify php page html output?
Any reason not to strip whitespace in HTML
I viewed some page sources and found some difference between them - some with indents some doesn't. The first screen capture is google's page source, and the second SO's.
I want to know whether eliminating those spaces improve page loading speed or it means smaller data flow from server to client. If doing so is meaningful, how do i do it before output data from server(I use PHP).
Without spaces-Google's page source:
With spaces-SO's page source:
This is called "minification". Most of the savings are in the bandwidth of not needing to transmit all of the extra whitespace, etc. - though even this is minimal overhead if GZip compression is used (transparently supported by all major web browsers and web servers). There may also be very slight performance savings in the browser not needing to parse through the additional whitespace.
There are many libraries that can do this for you. http://code.google.com/p/minify/ is just one of them.