Skip to content

Conversation

@GrigoryEvko
Copy link

This PR adds multi-threading support to gozstd, enabling parallel compression for better performance on multi-core systems.

Main changes:

  • Added NbWorkers parameter to Writer for controlling the number of compression threads
  • Implemented ZSTD_c_nbWorkers parameter support in the underlying zstd library
  • Rebuilt all static libraries with DZSTD_MULTITHREAD=1 flag
  • Added comprehensive tests for multi-threaded compression

Performance improvements:

  • The multi-threading support provides significant speedup for large files on multi-core CPUs
  • Compression speed scales nearly linearly with the number of workers for sufficiently large inputs
  • No performance regression for single-threaded operation (NbWorkers = 0 or 1)

Additional improvements:

  • Updated all static libraries to zstd v1.5.7
  • Added architecture-specific optimizations (SSE4.2, AVX2 for x86_64, NEON for ARM)
  • Improved build system to support multiple container runtimes
  • Added LTO support for additional performance gains

The API remains backward compatible - existing code will continue to work with single-threaded compression by default.

- Implement multi-threading API with NbWorkers parameter in Writer
- Add ZSTD_c_nbWorkers support for parallel compression
- Enable Link-Time Optimization (LTO) for all platform builds
- Update Makefile with LTO-enabled test and bench targets
- Rebuild all static libraries with -O3 -flto optimizations
- Add architecture-specific optimizations (SSE4.2, AVX2, BMI2 for x86_64, NEON for ARM)
- Update to v1.5.7-kernel tag from Facebook zstd
- Add parallel compilation support with -j flag
- Support multiple container runtimes (docker, nerdctl, podman)
- Remove -flto-jobs=1 flag to use default LTO parallelism
- Rebuild libzstd_linux_amd64.a with updated flags
- Rebuilt all platform libraries with latest LTO flag changes
- Linux/Windows platforms use -flto for optimization
- macOS platforms built without LTO due to toolchain limitations
- All libraries compiled with multi-threading support (DZSTD_MULTITHREAD=1)
- Architecture-specific optimizations maintained (SSE4.2, AVX2, BMI2, NEON)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant