The Savings
Gzipping generally reduces the response size by about 70%. Table 6-2 shows examples of size reductions for scripts and stylesheets (small and large). In addition to gzip, the results for deflate are also shown.
Table 6-2. Compression sizes using gzip and deflate
File type | Uncompressed size | Gzip size | Gzip savings | Deflate size | Deflate savings |
|---|---|---|---|---|---|
Script | 3,277 bytes | 1076 bytes | 67% | 1112 bytes | 66% |
Script | 39,713 bytes | 14,488 bytes | 64% | 16,583 bytes | 58% |
Stylesheet | 968 bytes | 426 bytes | 56% | 463 bytes | 52% |
Stylesheet | 14,122 bytes | 3,748 bytes | 73% | 4,665 bytes | 67% |
It's clear from Table 6-2 why gzip is typically the choice for compression. Gzip reduces the response by about 66% overall, while deflate reduces the response by 60%. For these files, gzip compresses ~6% more than deflate.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access