What is the largest size a gzip (say 10kb for the sake of an example) can be decompressed to?
It very much depends ont he data being compressed. A quick test with a 1Gb file full for zeros give a compressed size of ~120Kb, so your 10Kb file could potentially expand into ~85Mbytes. If the data has low redundancy to start with, for instance the archive contains images files in a format that is compressed natively (gif, jpg, png, ...), then gzip may add not further compression at all. For binary files like program executables you might see up to 2:1 compression, for plain text, HTML or other markup 3:1 or 4:1 or more is not unlikely. You might see 10:1 in some cases but the ~8700:1 seen with a file filled with a single symbol is something you are not going to see outside similarly artificial circumstances. You can check how much data would result from unpacking a gzip file, without actually writing its uncompressed content to disk, with |
|||||||||||||||||||||
|
Usually you don't get more than 95% compression (so that 10kB gzipped data would decompress to ~200kB), but there are specially crafted files that expand exponentially. Look for |
|||||||||
|
The compression ratio of any compression algorithm will be a function of the data being compressed (besides the length of that data). Here is an analysis at MaximumCompression, Summary of the multiple file compression benchmark tests File type : Multiple file types (46 in total) # of files to compress in this test : 510 Total File Size (bytes) : 316.355.757 Average File Size (bytes) : 620,305 Largest File (bytes) : 18,403,071 Smallest File (bytes) : 3,554 |
|||
|
A huge file containing only one symbol will compress very well. |
|||
|
10 MB of zeros in file, compress with gzip -9 to 10217. So maximal ratio looks to be around 1000x. |
|||
|