[Rpm-maint] Speeding up XZ processing

Florian Weimer fweimer at redhat.com
Thu Jul 31 14:35:08 UTC 2014

RPM currently requests SHA-256 hashing from XZ, which is superfluous for 
its main operations due to the RPM-based integrity checks.

Here are some ways to avoid this overhead:

Add an option to liblzma to disable checking on decompression.  I'll ask 
upstream about this.

Fix rpm2cpio and rpm2archive so that payload contents is checked against 
the file hashes in the header during processing.  (This would allow 
adding meaningful signature checking to these tools, too.)

When writing RPMs, specify LZMA_CHECK_NONE.  Set the PAYLOADFLAGS tag to 
"2 check=none" (or something similar).  Update applydeltarpm so that it 
specifies LZMA_CHECK_NONE if PAYLOADFLAGS has this value.

To measure the speed improvement during installation, you can use xzcat 
and "xz -2 --check=none" to recompress the payload (after detaching it 
from the header).

In my experiments, about 30% the time related to decompression is spent 
in SHA-256 hashing.  The win for compression is obviously smaller 
because compression itself takes more time.

Florian Weimer / Red Hat Product Security

More information about the Rpm-maint mailing list