[Optimize] Accelerate zlib crc32_z with PCLMULQDQ and VPCLMULQDQ on x86_64 platform - #53
[Optimize] Accelerate zlib crc32_z with PCLMULQDQ and VPCLMULQDQ on x86_64 platform#53liuweilw1024 wants to merge 1 commit into
Conversation
…86_64 Add PCLMULQDQ and VPCLMULQDQ based CRC32 SIMD implementations for zlib 1.2.13 on x86_64, providing significant speedup over the default table-based computation. - Add arch_x86.c/h for CPU feature detection (AVX, AVX512/VL) - Add crc32_x86.h with SIMD CRC32 kernels using PCLMULQDQ - Add crc32_x86_pclmul.c for AVX (128-bit) PCLMULQDQ path - Add crc32_x86_vpclmulqdq.c for AVX512/VL VPCLMULQDQ path - Modify crc32.c to dispatch to SIMD implementations at runtime - Update CMakeLists.txt to include new x86_64 source files - Add unit tests verifying SIMD CRC32 matches table-based reference
|
@liuweilw1024 Thanks for the optimization — the direction is right, the implementation is clean, and the tests are well covered. Before merging, could you add two things?
This change modifies the bundled extra/zlib copy directly, which means re-merging it on every future zlib upgrade — a long-term cost. I'd suggest first trying to upstream it to zlib: once accepted, we'd get it simply by following zlib releases, with zero extra maintenance. If upstream won't take it soon, please organize it as a minimal, well-isolated patch (separate files + a centralized dispatch hook) with its origin documented, to keep future zlib upgrades easy to merge. |
|
@sunjianhua1990s Thanks for your comment. Here are some performance statistics data and the progress pushing code to the upstream community of zlib.
[Response] 2、Performance gain in polardbx-engine
[Response] |






Add PCLMULQDQ and VPCLMULQDQ based CRC32 SIMD implementations for extra/zlib 1.2.13 on x86_64 platform, providing significant speedup over the default table-based computation.