changed default compression level to 3 (can be modified with macro ZSTDCLI_DEFAULT_CLEVEL)

This commit is contained in:
Yann Collet 2016-07-13 14:15:08 +02:00
parent fbc69f8649
commit 2cac5b30b9
3 changed files with 18 additions and 6 deletions

3
.gitignore vendored
View File

@ -37,3 +37,6 @@ _zstdbench/
# CMake # CMake
projects/cmake/ projects/cmake/
# Test artefacts
tmp*

View File

@ -330,7 +330,6 @@ static int FIO_compressFilename_internal(cRess_t ress,
} } } }
/* Main compression loop */ /* Main compression loop */
readsize = 0;
while (1) { while (1) {
/* Fill input Buffer */ /* Fill input Buffer */
size_t const inSize = fread(ress.srcBuffer, (size_t)1, ress.srcBufferSize, srcFile); size_t const inSize = fread(ress.srcBuffer, (size_t)1, ress.srcBufferSize, srcFile);
@ -338,8 +337,8 @@ static int FIO_compressFilename_internal(cRess_t ress,
readsize += inSize; readsize += inSize;
DISPLAYUPDATE(2, "\rRead : %u MB ", (U32)(readsize>>20)); DISPLAYUPDATE(2, "\rRead : %u MB ", (U32)(readsize>>20));
{ /* Compress using buffered streaming */ /* Compress using buffered streaming */
size_t usedInSize = inSize; { size_t usedInSize = inSize;
size_t cSize = ress.dstBufferSize; size_t cSize = ress.dstBufferSize;
{ size_t const result = ZBUFF_compressContinue(ress.ctx, ress.dstBuffer, &cSize, ress.srcBuffer, &usedInSize); { size_t const result = ZBUFF_compressContinue(ress.ctx, ress.dstBuffer, &cSize, ress.srcBuffer, &usedInSize);
if (ZBUFF_isError(result)) EXM_THROW(23, "Compression error : %s ", ZBUFF_getErrorName(result)); } if (ZBUFF_isError(result)) EXM_THROW(23, "Compression error : %s ", ZBUFF_getErrorName(result)); }
@ -366,8 +365,10 @@ static int FIO_compressFilename_internal(cRess_t ress,
} }
/* Status */ /* Status */
{ size_t const len = strlen(srcFileName);
if (len > 20) srcFileName += len-20; }
DISPLAYLEVEL(2, "\r%79s\r", ""); DISPLAYLEVEL(2, "\r%79s\r", "");
DISPLAYLEVEL(2,"%-20.20s :%6.2f%% (%6llu =>%6llu bytes, %s) \n", srcFileName, DISPLAYLEVEL(2,"%-20.20s :%6.2f%% (%6llu => %6llu bytes, %s) \n", srcFileName,
(double)compressedfilesize/readsize*100, (unsigned long long)readsize, (unsigned long long) compressedfilesize, (double)compressedfilesize/readsize*100, (unsigned long long)readsize, (unsigned long long) compressedfilesize,
dstFileName); dstFileName);

View File

@ -28,6 +28,14 @@
*/ */
/*-************************************
* Tuning parameters
**************************************/
#ifndef ZSTDCLI_DEFAULT_CLEVEL
# define ZSTDCLI_DEFAULT_CLEVEL 3
#endif
/*-************************************ /*-************************************
* Includes * Includes
**************************************/ **************************************/
@ -207,7 +215,7 @@ int main(int argCount, const char** argv)
nextArgumentIsMaxDict=0, nextArgumentIsMaxDict=0,
nextArgumentIsDictID=0, nextArgumentIsDictID=0,
nextArgumentIsFile=0; nextArgumentIsFile=0;
unsigned cLevel = 1; unsigned cLevel = ZSTDCLI_DEFAULT_CLEVEL;
unsigned cLevelLast = 1; unsigned cLevelLast = 1;
unsigned recursive = 0; unsigned recursive = 0;
const char** filenameTable = (const char**)malloc(argCount * sizeof(const char*)); /* argCount >= 1 */ const char** filenameTable = (const char**)malloc(argCount * sizeof(const char*)); /* argCount >= 1 */
@ -331,7 +339,7 @@ int main(int argCount, const char** argv)
/* test compressed file */ /* test compressed file */
case 't': decode=1; outFileName=nulmark; argument++; break; case 't': decode=1; outFileName=nulmark; argument++; break;
/* dictionary name */ /* destination file name */
case 'o': nextArgumentIsOutFileName=1; argument++; break; case 'o': nextArgumentIsOutFileName=1; argument++; break;
/* recursive */ /* recursive */