O'Reilly logo

Professional Website Performance: Optimizing the Front-End and Back-End by Peter Smith

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

Chapter 3

Content Compression

WHAT’S IN THIS CHAPTER?

  • Understanding how HTTP compression works
  • Becoming familiar with browser quirks and how to handle clients that don’t support compression
  • Exploring alternatives to gzip and deflate compression
  • Compressing directly in PHP

With bandwidth being a bottleneck for many users (and for dial-up users, easily the largest bottleneck), it’s not surprising that web masters would want to compress their content. The benefits are obvious — faster loading times for users and reduced data transfer bills for web masters. This chapter examines the available methods of compression, which browsers support them, and situations in which compression is not appropriate.

WHO USES COMPRESSION

Armed with a list of the 1,000 most popular websites (courtesy of Alexa.com), a quick test of average page sizes and compression support revealed how the top 20 rate, as shown in Table 3-1.

TABLE 3-1: Average Page Sizes of the Top 20 Websites

image

As you can see, compression is well supported. Of the top 1,000 sites, 227 did not support compression, with only 1 in the top 20 (live.com) and 10 in the top 100 not supporting it.

There’s also a fairly wide range in the amount of compression achieved in this Top 20 table, with the size of the compressed contents being anything between 15 percent and 60 percent of the original. In general, you should expect to see a compression ...

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