Have been using gzip for a few years and usually I always gzip -9 out of habit as it is the highest level of compression. I understand that lower levels means less compression but quicker compress rate.

What is the real difference between the levels of compression?

From what I have read regarding DEFLATE (what gzip uses), the levels specify the amount of time the algorithm spends finding repetition in bytes and encoding the data properly. I don't quite understand how this would differ between one pass of a file or multiple passes of a file. Wouldn't all bytes that are replicated be compressed on the first pass (all the repetition removed)?

  • What makes you think it's doing "multiple passes"? Oct 12, 2016 at 14:37
  • @Ƭᴇcʜιᴇ007 That is a valid point, limited knowledge of compression so perhaps I misread something somewhere to give me that idea. Is it not doing multiple passes?
    – IT_User
    Oct 12, 2016 at 14:42
  • Short answer: compression levels affects buffer size. See How do the different compression levels of gzip differ?
    – Sneg
    Apr 1, 2020 at 17:25


You must log in to answer this question.

Browse other questions tagged .