Lzma Vs Lzma2 Vs Ppmd Vs Bzip2
For some reason, "bzip2 -6" took more time than even "bzip -9". Theresult didn't change when the test was repeated. The extreme mode oflzmash creates a few bytes bigger files; seems that using "lzmash -e"makes compression both slower and less efficient with smaller files.Speed tables are omitted because the smaller test file makes measuringthe elapsed time with 'time' command too inaccurate.
lzma vs lzma2 vs ppmd vs bzip2
In terms of speed, gzip is the winner again. lzma comes rightbehind it two to three times slower than gzip. bzip2 is a lotslower taking usually two to six times more time than lzma, that is, fourto twelve times more than gzip. One interesting thing is that gzip andlzma decompress the faster the smaller the compressed size is, whilebzip2 gets slower when the compression ratio gets better.
The memory usage of lzma stays competitive with bzip2 when files havebeen compressed with "lzmash -6" or with a smaller option. The filescompressed with the default "lzmash -7" can still be decompressed, evenon machines with only 16 MB of RAM, but sometimes you don't have eventhat much memory available. If you compress with "lzmash -8" or"lzmash -9", you should think if the users need to be able todecompress your files also on "ancient" computers.
Of course, it depends on the intended application. gzip is very fastand has small memory footprint. According to this benchmark, neitherbzip2 nor lzma can compete with gzip in terms of speed or memoryusage. bzip2 has notably better compression ratio than gzip, whichhas to be the reason for the popularity of bzip2; it is slower thangzip especially in decompression and uses more memory. However thememory requirements of bzip2 should be nowadays no problem even onolder hardware.
zip is the method of compression employed by .zip files ("deflate"). It is fast in both compression and decompression, and has very low memory requirements (less than 1 MB for both compression and decompression at level 9), but generally does not compress nearly as well as the other supported methods. zip, like lzma2, has one special property, though: it will not expand incompressible data (e.g., files that are already compressed). If a compression level isn't specified, it defaults to 7.
lzma2 is the method of compression employed by the 7-Zip LZMA2 compressor. LZMA2 is a modified version of LZMA that offers a better compression ratio for incompressible data (random data expands about 0.005%, compared to 1.35% with original LZMA), and optionally can compress multiple parts of large files in parallel, greatly increasing compression speed but with a possible reduction in compression ratio (see LZMANumBlockThreads). Like LZMA, it can consume a lot of memory; see the above table. If a compression level isn't specified, it defaults to max.
GNU/Linux and *BSD have a wide range of compression algorithms available for file archiving purposes. There's gzip, bzip2, xz, lzip, lzma, lzop and less free tools like rar, zip, arc to choose from. Knowing which one to use can be so confusing. Here's an attempt to give you an idea how the various choices compare.
This crate provides a simple interface to liblzma. LZMA is more commonly known as XZ or 7zip,(as in, files with the .xz or .7z file extension). LZMA compression is fast and aggressive,compressing better than bzip2. liblzma implements the XZ variant, so it can read and write.xz files/streams. 076b4e4f54