Skip to content

Replacing ZLIB with ZLIB-NG #22573

@ocpalo

Description

@ocpalo

I opened this issue to discuss if we can replace 3rdparty/zlib with zlib-ng.

zlib-ng is a replacement with optimizations for "next generation" systems. It does have SIMD support and its API Is compatible if compiled with ZLIB_COMPAT flag.

According to their benchmark tests

Zlib-ng is about 4x faster than zlib (w/zlib-ng minigzip), and 2.1x faster than stock gzip from my Scientific Linux 7.
Zlib-ng decompression takes about 57% less time than zlib (w/zlib-ng minigzip), and 43% less time than gzip.

And someone also tested with libpng

zlib + libpng: ~1600ms
zlib-ng + libpng: ~510ms
zlib-ng + spng: ~740ms (SPNG_SSE=1 or 4 seems about the same)

On modern cpus where SIMD is available, this can improve some of the imagecodec performances. We can also add as optional zlib library. Let me know what you think. If OpenCV team approves, I am going to spend more time to understand the library and do more research about it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions