diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2014-09-13 18:49:01 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2014-09-13 18:49:01 (GMT) |
commit | 56c2b79ed015d4b154d4bd3a9cab27e7c613ba51 (patch) | |
tree | c2bf30ba320863f53e583ce4326b231dc331ecf7 /programs | |
parent | 38912f55e3c3b782529c2dd1e682d6af7c8bd052 (diff) | |
download | lz4-56c2b79ed015d4b154d4bd3a9cab27e7c613ba51.zip lz4-56c2b79ed015d4b154d4bd3a9cab27e7c613ba51.tar.gz lz4-56c2b79ed015d4b154d4bd3a9cab27e7c613ba51.tar.bz2 |
Frame decompression speed optimization
Diffstat (limited to 'programs')
-rw-r--r-- | programs/frametest.c | 9 | ||||
-rw-r--r-- | programs/fullbench.c | 14 |
2 files changed, 17 insertions, 6 deletions
diff --git a/programs/frametest.c b/programs/frametest.c index caa4956..8be7752 100644 --- a/programs/frametest.c +++ b/programs/frametest.c @@ -355,13 +355,13 @@ _output_error: } -static void locateBuffDiff(const void* buff1, const void* buff2) +static void locateBuffDiff(const void* buff1, const void* buff2, size_t size) { int p=0; BYTE* b1=(BYTE*)buff1; BYTE* b2=(BYTE*)buff2; while (b1[p]==b2[p]) p++; - printf("Error at pos %i : %02X != %02X \n", p, b1[p], b2[p]); + printf("Error at pos %i/%i : %02X != %02X \n", p, (int)size, b1[p], b2[p]); } @@ -473,13 +473,14 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi if (oSize > (size_t)(oend-op)) oSize = oend-op; oSize = oend-op; result = LZ4F_decompress(dCtx, op, &oSize, ip, &iSize, NULL); - if (result == (size_t)-ERROR_checksum_invalid) locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer); + if (result == (size_t)-ERROR_checksum_invalid) locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer, srcSize); CHECK(LZ4F_isError(result), "Decompression failed (error %i)", (int)result); op += oSize; ip += iSize; } CHECK(result != 0, "Frame decompression failed (error %i)", (int)result); crcDecoded = XXH64(decodedBuffer, op-(BYTE*)decodedBuffer, 1); + if (crcDecoded != crcOrig) locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer, srcSize); CHECK(crcDecoded != crcOrig, "Decompression corruption"); } @@ -613,7 +614,7 @@ int main(int argc, char** argv) if (nbTests<=0) nbTests=1; - if (testNb==0) result = basicTests(seed, ((double)proba) / 100); + //if (testNb==0) result = basicTests(seed, ((double)proba) / 100); if (result) return 1; return fuzzerTests(seed, nbTests, testNb, ((double)proba) / 100); } diff --git a/programs/fullbench.c b/programs/fullbench.c index f87b857..9292f20 100644 --- a/programs/fullbench.c +++ b/programs/fullbench.c @@ -354,6 +354,15 @@ static int local_LZ4_decompress_safe_usingDict(const char* in, char* out, int in return outSize; } +extern int LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize, const char* dict, int dictSize); + +static int local_LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize) +{ + (void)inSize; + LZ4_decompress_safe_forceExtDict(in, out, inSize, outSize, in - 65536, 65536); + return outSize; +} + static int local_LZ4_decompress_safe_partial(const char* in, char* out, int inSize, int outSize) { return LZ4_decompress_safe_partial(in, out, inSize, outSize - 5, outSize); @@ -380,7 +389,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) # define NB_COMPRESSION_ALGORITHMS 14 double totalCTime[NB_COMPRESSION_ALGORITHMS+1] = {0}; double totalCSize[NB_COMPRESSION_ALGORITHMS+1] = {0}; -# define NB_DECOMPRESSION_ALGORITHMS 8 +# define NB_DECOMPRESSION_ALGORITHMS 9 double totalDTime[NB_DECOMPRESSION_ALGORITHMS+1] = {0}; size_t errorCode; @@ -589,7 +598,8 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) case 5: decompressionFunction = LZ4_decompress_safe_withPrefix64k; dName = "LZ4_decompress_safe_withPrefix64k"; break; case 6: decompressionFunction = local_LZ4_decompress_safe_usingDict; dName = "LZ4_decompress_safe_usingDict"; break; case 7: decompressionFunction = local_LZ4_decompress_safe_partial; dName = "LZ4_decompress_safe_partial"; break; - case 8: decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress"; + case 8: decompressionFunction = local_LZ4_decompress_safe_forceExtDict; dName = "LZ4_decompress_safe_forceExtDict"; break; + case 9: decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress"; errorCode = LZ4F_compressFrame(compressed_buff, compressedBuffSize, orig_buff, benchedSize, NULL); if (LZ4F_isError(errorCode)) { DISPLAY("Preparation error compressing frame\n"); return 1; } chunkP[0].origSize = benchedSize; |