Skip to content

How to configure the number of threads? #322

Closed

Description

@leanhdung1994

From https://github.com/lz4/lz4/releases/tag/v1.10.0,

LZ4 v1.10.0 introduces major updates, integrating 600+ commits that significantly enhance its capabilities. This version brings multithreading support to the forefront, harnessing modern multi-core processors to accelerate both compression and decompression processing. It's a good upgrade for users looking to optimize performance in high-throughput environments.

Multithreading support: The most visible upgrade of this version is likely Multithreading support. While LZ4 has historically been recognized for its high-speed compression, the demand for even faster throughput has grown, particularly with the advent of nvme storage technologies that allow for multi-GB/s throughput. Multithreading is particularly beneficial for High Compression modes, which now perform dramatically faster.

Can we configure the number of threads in the Python binding?

import lz4.frame
import shutil

input_file = r"E:\Personal Projects\tmp\chunk_0.ndjson"
output_file = r"E:\Personal Projects\tmp\chunk_0.ndjson.lz4"

with open(input_file, "rb") as f, lz4.frame.open(output_file, mode="wb",) as g:
    shutil.copyfileobj(f, g)

Activity

  1. ypnos commented on Jan 12, 2026

    @ypnos

    This package does not offer multithreading. The multithreading in LZ4 with a thread pool is implemented in the tool code, not in the library code used by python-lz4.

  2. leanhdung1994 commented on Jan 14, 2026

    @leanhdung1994
    Author

    @ypnos Could you send me links to the tool code and the library code?

  3. ypnos commented on Jan 15, 2026

    @ypnos
  4. cclauss commented on Jan 18, 2026

    @cclauss
    Contributor
  5. leanhdung1994 commented on Jan 18, 2026

    @leanhdung1994
    Author

    This PR will allow setting the number of workers, right?

  6. ypnos commented on Jan 19, 2026

    @ypnos

    No, it won't. It will enable efficient use of threading in Python with lz4 package. But the threading itself still needs to be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions