Page 1 of 1

G-zip, does compression level matter?

Posted: Wed Nov 06, 2002 2:46 am
by Spaceman-Spiff
When using g-zip compression in gzcompress() function, we can select the compression level. I know its a trade-off between speed & server usage and output filesize. The question is, is there a significant difference in the filesize between level 9 and level 1 when using g-zip for HTML files?
I've read a few tutorials on g-zip, but none mentioned about the difference in compression level besides 9 = maximum compression level and 0 = none.

Posted: Wed Nov 06, 2002 5:24 am
by volka
imho the standard level is quite fine for text/html.

Posted: Wed Nov 06, 2002 4:33 pm
by Spaceman-Spiff
by standard, u mean level 5?

Posted: Thu Nov 07, 2002 6:49 am
by BDKR
Are you using a Linux box? If so, you could just as easily do a little testing yourself. Just create a file or take an existing one and compress it at the various levels and check the resulting sizes.

Cheers,
BDKR

Posted: Thu Nov 07, 2002 9:37 am
by mydimension
any where between 3 and 5 gives you pretty good results and the difference between those is pretty small.

Posted: Thu Nov 07, 2002 3:43 pm
by Spaceman-Spiff
i did a little test, if anyone interested:

File: mysql manual
Size: 2.5 MB
Type: html

Image

conclusion: use default (level 5 or 6)

Posted: Thu Nov 07, 2002 10:24 pm
by mydimension
hmm, pretty useful. thanx for that. although do remember that compression also is affected by the actual structure of the document, regardless of its size. sometimes the copression algoithim fits the contents nicely, other times not so nice. the differnece is almost negligable but i feel its needs pointing out next to a one time case study such as yours.

Posted: Fri Nov 08, 2002 6:28 am
by BDKR
Good show!