LZ Compression Now Eight Times Faster
Written by Mike James   
Monday, 12 August 2024

The latest release of the LZ compression algorithm has been released with support for multithreading, enabling a dramatic improvement in compression speeds of up to eight times.

LZ compression is an algorithm based on LZ dictionary compression. It is used to compress many popular file formats, and is used in GIF, Deflate, Zip, PNG. It was important enough to be named as an IEEE Milestone.

compress

 

LZ compression is one of a class of dictionary compression methods invented in 1978 by Abraham Lempel and Jacob Ziv. Dictionary compression methods are lossless and work by building up a dictionary of short sequences that can then be used to code the file in question, removing duplicates of the sequences and replacing them with a lookup to the dictionary. The LZW algorithm is also part of the UNIX file compression utility.

The new release, version 1.10 of LZ4, has been significantly improved with the addition of support for multithreading to make use of multi-core processors. This accelerates compression so will improve LZ4's use for high-throughput jobs.

While LZ4 has historically been recognized for its high-speed compression, the demand for even faster throughput has grown, particularly with the advent of nvme (nonvolatile memory express) storage technologies that allow for multi-GB/s throughput.

The developers provided the following benchmark table of performance improvements for compression:

cpuoslevelv1.9.4v1.10.0Improvement
7840HS Win11 12 13.4 sec 1.8 sec x7.4
M1 Pro macos 12 16.6 sec 2.55 sec x6.5
i7-9700k linux 12 16.2 sec 3.05 sec x5.4
7840HS Win11 9 20.8 sec 2.6 sec x8.0
M1 Pro macos 9 22.1 sec 2.95 sec x7.4
i7-9700k linux 9 22.9 sec 4.05 sec x5.7

They point out that multithreading is less critical for decompression, as modern nvme drives can still be saturated with a single decompression thread. However, the new version still enhances performance by overlapping I/O operations with decompression processes.

Tested on a x64 Linux platform, decompressing a 5 GB text file locally takes 5 seconds with v1.9.4; this is reduced to 3 seconds in v1.10.0, corresponding to > +60% performance improvement.

Alongside the multithreading support, the new release also adds full support for dictionary compression and decompression. This was experimental in the previous release. The developers say the full support means developers can use dictionary compression in applications that need it, such as for small data, where dictionary initialization can become a bottleneck. The dictionary state can be used by multiple threads concurrently.

This release also adds a new mid-range Level 2 compression that fills the substantial gap between the standard "Fast Level 1" and the more intensive "High Compression Level 3." The developers say it provides a balanced option, optimizing performance and compression, so is ideal for applications requiring better compression than level 1, without the speed trade-offs associated with high compression level 3.

LZ4 1.10 is available now on GitHub.

compress

More Information

LZ4 On GitHub

LZ4 Website

Related Articles

LZ Compression And The One-Bit Catastrophe

New Hutter Prize Milestone For Lossless Compression

Commemorating the Co-Creator of the L-Z Algorithm

Commemorating Jacob Ziv

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Pico 2W Announced But There Is A Surprise!
25/11/2024

Raspberry Pi released the Pico 2 a few months ago and we have been waiting for the Pico 2W since then. But Pimoroni beat them to the draw with the Pico Plus 2W based on the RM2 radio module and hinted [ ... ]



RAG from Scratch
10/12/2024

The "RAG from Scratch" tutorial by Langchain coupled with the "RAG playground" are two great educational resources that will help you kickstart your journey with RAG.


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 12 August 2024 )