Why xz compression




















Compression is useless without the ability to decompress it. Higher compression takes a lot of time. If compression time is more important than compression ratio, Gzip beats XZ. Honestly, lzop is much faster than Gzip and still compresses okay, so applications that need the fastest compression possible and don't require Gzip's ubiquity should look at that instead.

Sending data over slow links. The Linux 3. If you have a super fast connection, choosing XZ could mean saving one minute of download time; on a cheap DSL connection or a 3G cellular connection, it could shave an hour or more off the download time. Shrinking backup archives.

Compressing the source code for Apache's httpd If the same compressibility exists in a data set you currently store as GiB worth of. Copying this entire backup data set to a USB 2. Assuming you'll be working with these backups on a modern desktop system with plenty of CPU power and the one-time-only compression speed isn't a serious problem, using XZ compression generally makes more sense.

Why shuffle around extra data if you don't need to? Distributing large amounts of data that might be highly compressible. As previously mentioned, Linux 3. Source code and text in general is typically highly compressible because of the amount of redundancy in the contents, but compressors like Gzip that operate with a much smaller dictionary don't get to take advantage of redundancy that goes beyond their dictionary size.

The selection is highly dependent on the question "what are you planning to do with this data? Also check out this related post from which I learned some of the things I repeat here. Xz has a complex format, partially specialized in the compression of executables and designed to be extended by proprietary formats. Of the four compressors tested here, xz is the only one alien to the Unix concept of "doing one thing and doing it well".

It is the less appropriate for data sharing, and not appropriate at all for long-term archiving. In general, the more complex the format, the less probable that it can be decoded in the future. But the xz format, just as its infamous predecessor lzma-alone, is specially badly designed.

Xz copies almost all the defects of gzip and then adds some more, like the fragile variable-length integers. Just one bit-flip in bit 7 of any byte of one variable-length integer and the whole xz stream comes tumbling down like a house of cards. Using xz for anything other than compressing short-lived executables is not advisable. Don't interpret me wrong. In particular, it is shameful that support for lzma-alone was implemented in both GNU and Linux.

I Generally use rar or 7z for archiving normal files like documents. Honestly, I just get to know. So I just used its git repo to do a test. The total directory size is 91M, with a mixture of text and binary data. Here is my quick result. Maybe people still favor tar. I personally even use plain tar when there aren't many benefits to be gained in compression. For the same reason people in Windows r use zip files instead of 7zip, and some still use rar instead of other formats Each format has it's benefits and people use to stick to a solution they learned when began using a computer.

It is more complex than gzip with more compression options. This is not the only reason people might not always use xz. Another weakness is that it can use a lot of memory, especially for compression. The more you want to compress an item by the longer it takes and this is exponential with diminishing returns.

However, at compression level 1 for large binary items in my experience xz can often produce much smaller results in less time than zlib at level 9. Selecting a compression utility to use will depend mainly on two factors, the compression speed and rate of a given tool. Unlike its counterparts, xz is not commonly used but offers the best compression. In this article, we will explain a number of xz command examples for compressing and uncompressing files in Linux.

The simplest example of compressing a file with xz is as follows, using the -z or --compress option. If an operation fails, for instance a compressed file with same name exists, you can use the -f option to force the process. You can also use aliases such as --fast but least compression for 0 or --best for 9 slow but highest compression.

You can specify a compression level as in the examples below. You can run it in quiet mode using the -q option or enable verbose mode with the -v flag as shown. The following is an example of using tar archiving utility with xz utility. You can test the integrity of compressed files using the -t option and you can use the -l flag to view information about a compressed file. In this article, we looked at several xz command examples for compressing and uncompressing files.

Use the feedback form below to ask questions or share your thoughts about this tool. Also tell us about the compression tool you use. Change Language. Related Articles. Table of Contents. Save Article. Improve Article. Like Article. Last Updated : 28 Apr, Previous Strikethrough Text in Android. Recommended Articles. Article Contributed By :.



0コメント

  • 1000 / 1000