mirror of
https://github.com/lz4/lz4.git
synced 2026-10-24 01:48:57 +03:00
LZ4F_compressBound(), without autoFlush : - single-threaded : (srcSize / blockSize + 1) blocks, stored uncompressed in worst case, plus the frame footer. It covers up to (blockSize-1) buffered bytes, a buffered block emitted separately (mode switch), or remaining from an incomplete LZ4F_flush(). srcSize == 0 : one block + footer, so that LZ4F_flush() and LZ4F_compressEnd() complete in a single invocation, strictly below the bound (v1.10.0 guarantee kept). - nbWorkers >= 1 : the job replaces the block : ceil(srcSize / jobSize) jobs (1 for srcSize == 0) + footer, independently of nbWorkers. Updates defer completed jobs not fitting into dstBuffer : output is only required to start a job while all slots are busy. Flush and end emit jobs in flight in several invocations. nbWorkers is new : no existing user depends on a single invocation there. Multi-threaded LZ4F_uncompressedUpdate() : uncompressed segments are jobs storing blocks uncompressed ; a mode switch submits the job being filled (same output as single-threaded mode). A single LZ4F_mt_update() serves both updates : uncTail, LZ4F_mt_emitUncTail() and LZ4F_uncompressedUpdate_MT() are removed. lz4 : output buffer sized by LZ4F_compressBound(chunk) (~4 MB, instead of 72 MB with 8 threads), end of frame in a loop ; more threads within a memory budget (--memory=300M : 13 -> 23 threads) ; releaseLag = (2*nbWorkers+1) jobs + 64 KB. tests : frameMT (bound structure, flush / end loops), stream fuzzer (reference loops with nbWorkers).