From: Yann Collet Date: Fri, 17 Aug 2018 23:20:27 +0000 (-0700) Subject: fix : no longer slow down on input saturation X-Git-Tag: v1.3.6^2~19^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09e63c58ac38503b2338ac01229681048f0e3648;p=thirdparty%2Fzstd.git fix : no longer slow down on input saturation only slows down when all buffers are full --- diff --git a/programs/fileio.c b/programs/fileio.c index 02da1df95..fcb43030a 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -808,9 +808,12 @@ FIO_compressZstdFrame(const cRess_t* ressPtr, cpszfp = zfp; - if ( (zfp.ingested == cpszfp.ingested) - && (zfp.consumed == cpszfp.consumed) ) { - DISPLAYLEVEL(2, "no data read nor consumed : buffers are full (?) output is too slow => slow down ; or compression is slow + input has reached its limit => can't tell \n") + if ( (zfp.ingested == cpszfp.ingested) /* no data read : input buffer full */ + && (zfp.consumed == cpszfp.consumed) /* no data compressed : no more buffer to compress OR compression is really slow */ + && (zfp.nbActiveWorkers == 0) /* confirmed : no compression : either no more buffer to compress OR not enough data to start first worker */ + && (zfp.currentJobID > 0) /* first job started : only remaining reason is no more available buffer to start compression */ + ) { + DISPLAYLEVEL(6, "all buffers full : compression stopped => slow down \n") speedChange = slower; }