Operation Mega-Compression

Joined
Dec 28, 2009
Messages
396
Reaction score
5
Points
18
Your Mac's Specs
Macbook Unibody 2.26 Dual, 2GB RAM, 250 GB HDD
Compressing a compressed file does not, in fact, reduce its size lol. Save your money.
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
All digital data is comprised of basic elements (think binary, ones and zeros). When you run compression on it, you're basically applying an algorithm (a mathematical process) which finds synergies in the file and express the file in a different form. Then, when you uncompress the file, that same algorithm is essentially run in reverse to put the file back as it was. It's roughly analogous to using exponents to express a big number with a minimal amount of writing.

So, if you compress a compressed file, you're doing nothing as all of the efficiencies have already been exploited.
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
It may be easier to see with a simple example - one type of compression (probably the easiest to understand, but only used for certain types of data) called RLE or Run Length Encoding would take something and compress it by values that are next to each other - basically if the file had a large sequence of a given value, it would reduce that sequence to a single representation of that value and a multiplier to let the decompression technology know how to rebuild the original file - so, for example if you had:
a file containing:

HHHHHHHHHBBBBBBBBBCCCCCCCCCEEEEDDDDDD

it would be compressed to:

9H9B9C4E6D

Which as you can tell, is a very small file as is compared to the original, it went from 37 bytes down to 10 bytes - a huge savings as the file is now less than 1/3 the original size. Now, let's say you could compress it again, using the same general method of encoding, you might end up with:

191H191B141E161D

I've now increased the file from 10 bytes long to 16 bytes long (since the numbers would be one value, and the letters would be another value and each would be a single "chain" of values).

As you can see, in this very simple and very impractical example, re-compressing a compressed file is inefficient and can cause you to end up with a file larger than the original.

As you can also see, a RLE compression or encoding of the data really reduces the file size when it comes to a file with large groups of same values next to each other.

One might ask why people distribute compressed files that aren't really compressed on the net? Well, for one reason, a lot of sites, email servers, etc. won't allow an executable to be sent - so putting it in a zip file fixes that issue. Another reason is if there are a group of compressed files that make up something - you might have another compressed file holding the group of compressed files (may seem like a waste of time, but it makes it easier for some places to do it that way then to re-pack a group of files)

So yes, ultimately, what you said - compressing a compressed file doesn't do anything - but could actually make matters worse. Compressing an uncompressed file tho, with an algorithm that fits the data, can greatly reduce the overall file size.
 
Joined
Mar 30, 2004
Messages
4,744
Reaction score
381
Points
83
Location
USA
Your Mac's Specs
12" Apple PowerBook G4 (1.5GHz)
I can't hope to match Nethfel's example, so let me offer a weak analogy instead.

If you have a trash compactor, you can compress several bags' worth of trash into one. But if you then take several loads worth of compacted trash and put them back into the compactor to compress them again, you won't get any additional reduction in size. Everything has already been crushed together as tight as the machine's maximum pressure will allow.

Or you may just burn out your compactor.

It's a weak analogy, but basically, there are limits...otherwise we'd just keep compressing the files until they took up no space at all.
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Haha, thanks for the compliment - actually, I really like your description of the concept Technologist!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top