From: Yann Collet Date: Fri, 21 Sep 2018 23:35:43 +0000 (-0700) Subject: simplified "slows down when compression blocked" X-Git-Tag: v1.3.6^2~19^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00c18c0c884370f434a212e52ba425db8b70de80;p=thirdparty%2Fzstd.git simplified "slows down when compression blocked" --- diff --git a/programs/fileio.c b/programs/fileio.c index 407680eff..964870f39 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -896,12 +896,12 @@ FIO_compressZstdFrame(const cRess_t* ressPtr, assert(zfp.produced >= previous_zfp_update.produced); assert(g_nbWorkers >= 1); - /* test if output speed is so slow that all buffers are full - * and no further progress is possible - * (neither compression nor adding more input into internal buffers) */ - if ( (zfp.ingested == previous_zfp_update.ingested) /* no data read : input buffer full */ - && (zfp.consumed == previous_zfp_update.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 */ + /* test if compression is blocked + * either because output is slow and all buffers are full + * or because input is slow and no job can start while waiting for at least one buffer to be filled. + * note : excluse starting part, since currentJobID > 1 */ + if ( (zfp.consumed == previous_zfp_update.consumed) /* no data compressed : no data available, or no more buffer to compress to, OR compression is really slow (compression of a single block is slower than update rate)*/ + && (zfp.nbActiveWorkers == 0) /* confirmed : no compression ongoing */ ) { DISPLAYLEVEL(6, "all buffers full : compression stopped => slow down \n") speedChange = slower;