Forum Moderators: open
I recently re-worked the code for an existing site and found that saving even 1kb took more than eliminating tabs and line spaces. Some WYSIWYG editors really pump out the tab formatting - I've always thought it was excessive. 1 character is 8 bytes, I believe, so a couple hundred tabs and you've quickly added 2kb or more. Still, 2kb of text isn't all that much on today's web with native modem compression available.
But even more than bandwidth savings, I think all that formatting makes it HARDER to read the code, especially for table grid layouts.
I agree, though, that eliminating whitespace should be some way down the list in website optimization. Some factors that are usually more important include:
1. Ensure graphics are compressed.
2. Specify height and width for all graphics. (Speeds page rendering.)
3. Validate all HTML, and specify a DOCTYPE that will trigger standards compliance mode -- again, speeds rendering.
4. Use one external stylesheet. (Or as few as is reasonable for your site.) Try to keep it under 1160 bytes, to fit in one higher-speed TCP-IP packet.
5. Where possible, enable incremental rendering of tables. (For example, if you can tell the browser the number of columns, and their widths, the table will render much faster.)
6. Whitespace-crunching, and other extreme optimizations, may be worthwhile on a home page, or high traffic page.
Nick
>> Try to keep it under 1160 bytes, to fit in one higher-speed TCP-IP packet.
- is this in fact the size? No kidding? I didn't know that, thanks :)
My understanding is that packet size, negotiated at connection time, is typically between 576 and 1500 bytes, depending on connection speed.
On faster connections (> 128Kbps), packet size is typically 1500 bytes. Subtracting TCP/IP overhead of 40 bytes, and HTTP response header when the server first answers a client request (250-300 bytes), leaves 1160-1210 bytes.
It has been shown that, on faster connections, download time is directly affected by the total number of TCP/IP packets. So squeezing an external CSS file into the first available slot (assuming nothing else in <HEAD>) is optimal.
Nick
Except of course that in most web communicatiosn th etransfer is funished, long before this process is complete. So ultimatiely you'RE stuck in the worst case and should design your packet alignment for that. I jsut read the RFC for it, but am too lazy to look it up. Just google for HTTP/1.1 packet size slow start RFC.
Ah, there it is: www.w3.org/Protocols/HTTP/Performance/Pipeline.html
SN
the point is, if you use a space for indentation on a signle - that's ok. if you use it for indentation everywhere - consider CSS. this way you might save a couple of kilobytes in a big page.
[edited by: engine at 9:11 pm (utc) on Aug. 1, 2003]
[edit reason] No sigs, thanks. See TOS [webmasterworld.com] [/edit]