Skip to content

testing/zlib-ng-compat: new aport

Ilya Leoshkevich requested to merge iii/aports:zlib-ng-compat into master

https://github.com/zlib-ng/zlib-ng Drop-in zlib replacement with optimizations for next generation systems

Currently Alpine contains community/zlib-ng, which is compiled in the "native" mode, that is, in order to use it, applications must explicitly target it.

Add zlib-ng compiled in the "compat" mode, which allows it to be used as a drop-in zlib replacement. This allows users to benefit from zlib-ng optimizations while using the existing apps linked with zlib.

This is especially important on s390x, where zlib-ng contains support for the hardware deflate accelerator, which can compress up to 100x times faster than zlib on Z_BEST_SPEED level. The respective support for zlib exists only as a PR [1] and is therefore harder to integrate. At the same time the code is mature: it's shipped with RHEL 8+, SLES 12+ and Ubuntu 19.10+.

The new aport code is based on community/zlib-ng. The differences are:

  • Compatibility mode and s390x DFLTCC are enabled.

  • Sanitizers and dual linking are disabled.

  • version.patch is added in order to fix:

    ERROR: zlib-ng-compat-dev: usr/lib/pkgconfig/zlib.pc: pkgconf version 1.2.11.zlib-ng is invalid

With that, we get the expected speed-up on s390x:

# time -p python -c 'import zlib; zlib.compress(b"A" * 1000000000, level=1)'
real 2.72

# apk add ~/packages/testing/s390x/*.apk
(1/3) Purging zlib (1.2.13-r0)
(2/3) Installing zlib-ng-compat (2.0.7-r0)
(3/3) Installing zlib-ng-compat-dev (2.0.7-r0)

# time -p python -c 'import zlib; zlib.compress(b"A" * 1000000000, level=1)'
real 0.41

[1] https://github.com/madler/zlib/pull/410

Merge request reports