Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I just downloaded MySQL for Windows 64bit which 211.9MB but when I extracted it it is now 1.05GB. How did they do it? They archive wasn't damaged at all nor corrupted.

Before (Compressed):

After: (Uncompressed):

I was just totally amazed, I thought this wasn't possible. Archive info from WinRar:

share|improve this question
    
If it was damaged or corrupt it wouldn't have extracted in the first place. –  Alan B Feb 19 '13 at 13:55
11  
You've never received an attachment that would uncompress to 128 TB binary zeroes followed by "You've been zipped"? –  ott-- Feb 19 '13 at 14:19
    
noped, I have not. –  Pineapple Under the Sea Mar 9 at 11:22

4 Answers 4

up vote 7 down vote accepted

The compression ratio used may depend on the files that are being compressed. A text file with one million "ABC" will probably have a very good compression ratio. Additionally, they have probably chosen a good compression algorithm and the highest possible settings.

share|improve this answer
1  
Create a 1GB file with all bytes the same and it'll indeed compress fairly spectacularly! –  Alan B Feb 19 '13 at 13:57
1  
People used to create "archive bombs" like this. You'd email a tiny zip file to someone, their mail server's AV would extract it, find another archive, extract it, run out of memory, and crash. I've got a 6kb gzip file somewhere that, when fully extracted, is something like 40GB.. –  rbsec Feb 19 '13 at 18:58

Deflate is one of the most used compression algorithms. It searches for patterns on the data and stores it on a dictionary. The more "repetitive" a file is, the more it can be compressed. A very good explanation of the algorithm can be found here.

share|improve this answer
    
Once I wrote a script to test 7zip power by compressing a 3gb txt full of 1's. The result was a file of ~60kb –  kbsou Feb 19 '13 at 14:04
    
That's not very good compression for such a file. Did you try to re-compress the compressed file? –  Adrian Pronk Feb 20 '13 at 9:21
2  
Actually I started sending the file to my friends as a prank –  kbsou Feb 20 '13 at 12:47

Different files can be compressed to different sizes.
For example, if you compress bitmap or text files, you'll get high results.
It also depends on compressor program and its method of compression (just use 7Zip instead of WinRAR and you'll see that it compresses much better).

Recently I've found KGB Archiver, which is probably the best high-compression tool for today.
I couldn't believe that file which size is ~1GB can be compressed to some MBs, but it could do it!!
So 19% compressed archive seems nothing compared to it ;)
It uses PAQ6 algorithm, thus it needs a lot of CPU and RAM to compress.
Now it's an open-source project and is located in SourceForge. You can download it here.

share|improve this answer
2  
"KGB Archiver, which is probably the best high-compression tool today" - PAQ6 has many successors now which are much better. Of course, these aren't suitable for general use because the RAM/CPU/time requirements are just too high for both compression and decompression. –  Karan Feb 19 '13 at 18:46
    
+1 Coool... I haven't seen it before –  SEARAS Mar 24 '13 at 21:04
    
@Karan Can you tell us some of their names?? –  SEARAS Mar 24 '13 at 21:05
    
@SEARAS: The Wikipedia article on PAQ is a good starting point. –  Karan Mar 25 '13 at 4:37
    
Thanks, I'll look for it. –  SEARAS Mar 27 '13 at 19:40

Your question inspired me to do some research and learn a little bit about compression works.

How did they do it? Basically, lots of epic math, but one basic method is Huffman Coding

The file is divided into chunks, those chunks are sorted into a tree, with the most common blocks being given the shortest location names in the tree. The zip is created from a description of the tree followed a list of addresses in the tree required to rebuild the file. Sometimes a pre-computed tree is used this eliminates the need to share the tree. The more repetitious the program, the smaller the tree and better the compression. There is so much more to it then this though, it's complicated.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.