Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 284517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:27:54+00:00 2026-05-12T05:27:54+00:00

I was thinking about compression, and it seems like there would have to be

  • 0

I was thinking about compression, and it seems like there would have to be some sort of limit to the compression that could be applied to it, otherwise it’d be a single byte.

So my question is, how many times can I compress a file before:

  • It does not get any smaller?
  • The file becomes corrupt?

Are these two points the same or different?

Where does the point of diminishing returns appear?

How can these points be found?

I’m not talking about any specific algorithm or particular file, just in general.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:27:55+00:00Added an answer on May 12, 2026 at 5:27 am

    For lossless compression, the only way you can know how many times you can gain by recompressing a file is by trying. It’s going to depend on the compression algorithm and the file you’re compressing.

    Two files can never compress to the same output, so you can’t go down to one byte. How could one byte represent all the files you could decompress to?

    The reason that the second compression sometimes works is that a compression algorithm can’t do omniscient perfect compression. There’s a trade-off between the work it has to do and the time it takes to do it. Your file is being changed from all data to a combination of data about your data and the data itself.

    Example

    Take run-length encoding (probably the simplest useful compression) as an example.

    04 04 04 04 43 43 43 43 51 52 11 bytes

    That series of bytes could be compressed as:

    [4] 04 [4] 43 [-2] 51 52 7 bytes (I’m putting meta data in brackets)

    Where the positive number in brackets is a repeat count and the negative number in brackets is a command to emit the next -n characters as they are found.

    In this case we could try one more compression:

    [3] 04 [-4] 43 fe 51 52 7 bytes (fe is your -2 seen as two’s complement data)

    We gained nothing, and we’ll start growing on the next iteration:

    [-7] 03 04 fc 43 fe 51 52 8 bytes

    We’ll grow by one byte per iteration for a while, but it will actually get worse. One byte can only hold negative numbers to -128. We’ll start growing by two bytes when the file surpasses 128 bytes in length. The growth will get still worse as the file gets bigger.

    There’s a headwind blowing against the compression program–the meta data. And also, for real compressors, the header tacked on to the beginning of the file. That means that eventually the file will start growing with each additional compression.


    RLE is a starting point. If you want to learn more, look at LZ77 (which looks back into the file to find patterns) and LZ78 (which builds a dictionary). Compressors like zip often try multiple algorithms and use the best one.

    Here are some cases I can think of where multiple compression has worked.

    1. I worked at an Amiga magazine that shipped with a disk. Naturally, we packed the disk to the gills. One of the tools we used let you pack an executable so that when it was run, it decompressed and ran itself. Because the decompression algorithm had to be in every executable, it had to be small and simple. We often got extra gains by compressing twice. The decompression was done in RAM. Since reading a floppy was slow, we often got a speed increase as well!
    2. Microsoft supported RLE compression on bmp files. Also, many word processors did RLE encoding. RLE files are almost always significantly compressible by a better compressor.
    3. A lot of the games I worked on used a small, fast LZ77 decompressor. If you compress a large rectangle of pixels (especially if it has a lot of background color, or if it’s an animation), you can very often compress twice with good results. (The reason? You only have so many bits to specify the lookback distance and the length, So a single large repeated pattern is encoded in several pieces, and those pieces are highly compressible.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just thinking about the best way to build an Order form that would (from
When thinking about iPhone/iPad applications security, I can notice that there is: Widely available
I am currently thinking about implementing an application with NHibernate and I would like
I'm thinking about a database design that will have two tables Members and Groups.
The game I am thinking about where this solution would be applied, is a
Thinking about avoiding code replication, I got a question that catches me every time
I am thinking about making a program that will need to send input and
I have been thinking about a way solve a problem I have and I'm
Without thinking about it too much, I've been doing something like the following: 1)
So I've been thinking lately about how compression might be implemented, and what I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.