O'Reilly logo

Web Performance Tuning by Patrick Killelea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HTML

About HTML and Compression

A slight amount of waste is intrinsic to HTML, because HTML is written in ASCII text. ASCII is defined as using only seven bits of each byte, so one bit in eight, or 12.5%, is wasted. A larger amount of waste is due to the fact that text is highly compressible, but no compression is used for most HTTP transfers. It is normal for a text compression program to reduce the size of a text file by half, meaning that file can then be downloaded in half the time. Right now, transmission bandwidth is the bottleneck and CPU power for decompression is cheap, so compressing web pages would seem to make sense, even if it would make debugging problems harder.

Lack of compression is not an issue for small pages, but large text pages can be sent significantly more quickly in compressed format to a browser that understands gzip compression, for example. (I believe Mosaic is the only popular browser that understands gzip.) Another option is to compress your content and configure your web server to use a certain MIME type for that compressed content, but you then have to ask your users to configure their browser to launch the decompression utility when a file with a certain content type is received. This requires a bit of work on both the client and server side.

Performance Tips for HTML Authors

Make it easy on the server

When composing HTML, try to keep pathnames short, both in number of directories in the path and in the length of each directory name.

You can scale static ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required