]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix : no longer slow down on input saturation
authorYann Collet <cyan@fb.com>
Fri, 17 Aug 2018 23:20:27 +0000 (16:20 -0700)
committerYann Collet <cyan@fb.com>
Fri, 17 Aug 2018 23:27:43 +0000 (16:27 -0700)
only slows down when all buffers are full

programs/fileio.c

index 02da1df95b4c721489c4da84b46399948b2e4992..fcb43030ab4e88134828b770880e7ceb208b4da1 100644 (file)
@@ -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;
                     }