added additional tests for performance, allowed force compression level for testing purposes

dev
Paul Cruz 2017-07-13 14:46:54 -07:00
parent 9165e97fc6
commit 0d9665cef5
2 changed files with 62 additions and 28 deletions

View File

@ -33,6 +33,7 @@ static UTIL_time_t g_startTime;
static size_t g_streamedSize = 0; static size_t g_streamedSize = 0;
static unsigned g_useProgressBar = 0; static unsigned g_useProgressBar = 0;
static UTIL_freq_t g_ticksPerSecond; static UTIL_freq_t g_ticksPerSecond;
static unsigned g_forceCompressionLevel = 0;
typedef struct { typedef struct {
void* start; void* start;
@ -223,6 +224,10 @@ static void waitUntilAllJobsCompleted(adaptCCtx* ctx)
*/ */
static unsigned adaptCompressionLevel(adaptCCtx* ctx) static unsigned adaptCompressionLevel(adaptCCtx* ctx)
{ {
if (g_forceCompressionLevel) {
return g_compressionLevel;
}
else {
unsigned reset = 0; unsigned reset = 0;
unsigned const allSlow = ctx->adaptParam < ctx->stats.compressedCounter && ctx->adaptParam < ctx->stats.writeCounter && ctx->adaptParam < ctx->stats.readyCounter; unsigned const allSlow = ctx->adaptParam < ctx->stats.compressedCounter && ctx->adaptParam < ctx->stats.writeCounter && ctx->adaptParam < ctx->stats.readyCounter;
unsigned const compressWaiting = ctx->adaptParam < ctx->stats.readyCounter; unsigned const compressWaiting = ctx->adaptParam < ctx->stats.readyCounter;
@ -252,6 +257,7 @@ static unsigned adaptCompressionLevel(adaptCCtx* ctx)
} }
return ctx->compressionLevel; return ctx->compressionLevel;
} }
}
static size_t getUseableDictSize(unsigned compressionLevel) static size_t getUseableDictSize(unsigned compressionLevel)
{ {
@ -649,6 +655,9 @@ int main(int argCount, const char* argv[])
forceStdout = 1; forceStdout = 1;
outFilename = stdoutmark; outFilename = stdoutmark;
break; break;
case 'f':
g_forceCompressionLevel = 1;
break;
default: default:
DISPLAY("Error: invalid argument provided\n"); DISPLAY("Error: invalid argument provided\n");
ret = 1; ret = 1;

View File

@ -1,4 +1,4 @@
echo "testing time" echo "testing time -- no limits set"
./datagen -g1GB > tmp ./datagen -g1GB > tmp
time ./adapt -otmp1.zst tmp time ./adapt -otmp1.zst tmp
time zstd -1 -o tmp2.zst tmp time zstd -1 -o tmp2.zst tmp
@ -14,7 +14,7 @@ time ./adapt -otmp1.zst tmp
time zstd -1 -o tmp2.zst tmp time zstd -1 -o tmp2.zst tmp
rm tmp* rm tmp*
echo -e "\ntesting compression ratio" echo -e "\ntesting compression ratio -- no limits set"
./datagen -g1GB > tmp ./datagen -g1GB > tmp
time ./adapt -otmp1.zst tmp time ./adapt -otmp1.zst tmp
time zstd -1 -o tmp2.zst tmp time zstd -1 -o tmp2.zst tmp
@ -32,3 +32,28 @@ time ./adapt -otmp1.zst tmp
time zstd -1 -o tmp2.zst tmp time zstd -1 -o tmp2.zst tmp
ls -l tmp1.zst tmp2.zst ls -l tmp1.zst tmp2.zst
rm tmp* rm tmp*
echo e "\ntesting performance at various compression levels -- no limits set"
./datagen -g1GB > tmp
echo "adapt"
time ./adapt -i5 -f tmp -otmp1.zst
echo "zstdcli"
time zstd -5 tmp -o tmp2.zst
ls -l tmp1.zst tmp2.zst
rm tmp*
./datagen -g1GB > tmp
echo "adapt"
time ./adapt -i10 -f tmp -otmp1.zst
echo "zstdcli"
time zstd -10 tmp -o tmp2.zst
ls -l tmp1.zst tmp2.zst
rm tmp*
./datagen -g1GB > tmp
echo "adapt"
time ./adapt -i15 -f tmp -otmp1.zst
echo "zstdcli"
time zstd -15 tmp -o tmp2.zst
ls -l tmp1.zst tmp2.zst
rm tmp*