github lz4/lz4 v1.9.4
LZ4 v1.9.4

21 months ago

LZ4 v1.9.4 is a maintenance release, featuring a substantial amount (~350 commits) of minor fixes and improvements, making it a recommended upgrade. The stable portion of liblz4 API is unmodified, making this release a drop-in replacement for existing features.

Improved decompression speed

Performance wasn't a major focus of this release, but there are nonetheless a few improvements worth mentioning :

  • Decompression speed on high-end ARM64 platform is improved, by ~+20%. This is notably the case for recent M1 chips, featured in macbook laptops and nucs. Some server-class ARM64 cpus are also impacted, most notably when employing gcc as a compiler. Due to the diversity of aarch64 chips in service, it's still difficult to have a one-size-fits-all policy for this platform.
  • For the specific scenario of data compressed with -BD4 setting (small blocks, <= 64 KB, linked) decompressed block-by-block into a flush buffer, decompression speed is improved ~+70%. This is most visible in the lz4 CLI, which triggers this exact scenario, but since the improvement is achieved at library level, it may also apply to other scenarios.
  • Additionally, for compressed data employing the lz4frame format (native format of lz4 CLI), it's possible to ignore checksum validation during decompression, resulting in speed improvements of ~+40% . This capability is exposed at both CLI (see --no-crc) and library levels.

New experimental library capabilities

New liblz4 capabilities are provided in this version. They are considered experimental at this stage, and the most useful ones will be upgraded as candidate "stable" status in an upcoming release :

  • Ability to require lz4frame API to employ custom allocators for dynamic allocation.
  • Partial decompression of LZ4 blocks compressed with a dictionary, using LZ4_decompress_safe_partial_usingDict() by @yawqi
  • Create lz4frame blocks which are intentionally uncompressed, using LZ4F_uncompressedUpdate(), by @alexmohr
  • New API unit lz4file, abstracting File I/O operations for higher-level programs and libraries, by @anjiahao1
  • liblz4 can be built for freestanding environments, using the new build macro LZ4_FREESTANDING, by @t-mat. In which case, it will not link to any standard library, disable all dynamic allocations, and rely on user-provided memcpy() and memset() operations.

Miscellaneous

  • Fixed an annoying Makefile bug introduced in v1.9.3, in which CFLAGS was no longer respected when provided from environment variable. The root cause was an obscure bug in make, which has been fixed upstream following this bug report. There is no need to update make to build liblz4 though, the Makefile has been modified to circumvent the issue and remains compatible with older versions of make.
  • Makefile is compatible with -j parallel run, including to run parallel tests (make -j test).
  • Documentation of LZ4 Block format has been updated, featuring notably a paragraph "Implementation notes", underlining common pitfalls for new implementers of the format

Changes list

Here is a more detailed list of updates introduced in v1.9.4 :

  • perf : faster decoding speed (~+20%) on Apple Silicon platforms, by @zeux
  • perf : faster decoding speed (~+70%) for -BD4 setting in CLI
  • api : new function LZ4_decompress_safe_partial_usingDict() by @yawqi
  • api : lz4frame: ability to provide custom allocators at state creation
  • api : can skip checksum validation for improved decoding speed
  • api : new experimental unit lz4file for file i/o API, by @anjiahao1
  • api : new experimental function LZ4F_uncompressedUpdate(), by @alexmohr
  • cli : --list works on stdin input, by @Low-power
  • cli : --no-crc does not produce (compression) nor check (decompression) checksums
  • cli : fix: --test and --list produce an error code when parsing invalid input
  • cli : fix: support skippable frames when passed via stdin, reported by @davidmankin
  • build: fix: Makefile respects CFLAGS directives passed via environment variable
  • build: LZ4_FREESTANDING, new build macro for freestanding environments, by @t-mat
  • build: make and make test are compatible with -j parallel run
  • build: AS/400 compatibility, by @jonrumsey
  • build: Solaris 10 compatibility, by @pekdon
  • build: MSVC 2022 support, by @t-mat
  • build: improved meson script, by @eli-schwartz
  • doc : Updated LZ4 block format, provide an "implementation notes" section

New Contributors

Don't miss a new lz4 release

NewReleases is sending notifications on new releases.