diff --git a/programs/Makefile b/programs/Makefile index 1949362b..7aff00d5 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -66,10 +66,10 @@ zstd: $(ZSTDDIR)/zstd.c xxhash.c bench.c fileio.c zstdcli.c zstd32: $(ZSTDDIR)/zstd.c xxhash.c bench.c fileio.c zstdcli.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) -fullbench : $(ZSTDDIR)/zstd.c fullbench.c +fullbench : $(ZSTDDIR)/zstd.c datagen.c fullbench.c $(CC) $(FLAGS) $^ -o $@$(EXT) -fullbench32: $(ZSTDDIR)/zstd.c fullbench.c +fullbench32: $(ZSTDDIR)/zstd.c datagen.c fullbench.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) fuzzer : $(ZSTDDIR)/zstd.c xxhash.c fuzzer.c diff --git a/programs/datagen.c b/programs/datagen.c index e5471727..7db7016a 100644 --- a/programs/datagen.c +++ b/programs/datagen.c @@ -169,7 +169,7 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match void RDG_genBuffer(void* buffer, size_t size, double matchProba, double litProba, unsigned seed) { void* ldctx; - if (litProba==0.0) litProba = matchProba / 3.6; + if (litProba==0.0) litProba = matchProba / 3.8; ldctx = RDG_createLiteralDistrib(litProba); RDG_genBlock(buffer, size, 0, matchProba, ldctx, &seed); } @@ -185,7 +185,7 @@ void RDG_genOut(unsigned long long size, double matchProba, double litProba, uns void* ldctx; /* init */ - if (litProba==0.0) litProba = matchProba / 3.6; + if (litProba==0.0) litProba = matchProba / 3.8; ldctx = RDG_createLiteralDistrib(litProba); SET_BINARY_MODE(stdout); diff --git a/programs/fullbench.c b/programs/fullbench.c index 99ac0b9e..0268ba17 100644 --- a/programs/fullbench.c +++ b/programs/fullbench.c @@ -115,8 +115,6 @@ #define DEFAULT_CHUNKSIZE (4<<20) static double g_compressibilityDefault = 0.50; -static const U32 prime1 = 2654435761U; -static const U32 prime2 = 2246822519U; static const size_t sampleSize = 10000000; @@ -216,59 +214,6 @@ static U64 BMK_GetFileSize(char* infilename) } -#if 1 -static U32 BMK_rotl32(unsigned val32, unsigned nbBits) { return((val32 << nbBits) | (val32 >> (32 - nbBits))); } - -static U32 BMK_rand(U32* src) -{ - U32 rand32 = *src; - rand32 *= prime1; - rand32 += prime2; - rand32 = BMK_rotl32(rand32, 13); - *src = rand32; - return rand32 >> 9; -} - -#define BMK_RAND15BITS ( BMK_rand(&seed) & 0x7FFF) -#define BMK_RANDLENGTH ((BMK_rand(&seed) & 3) ? (BMK_rand(&seed) % 15) : (BMK_rand(&seed) % 510) + 15) -#define BMK_RANDCHAR (BYTE)((BMK_rand(&seed) & 63) + '0') -static void BMK_datagen(void* buffer, size_t bufferSize, double proba, U32 seed) -{ - BYTE* BBuffer = (BYTE*)buffer; - unsigned pos = 0; - U32 P32 = (U32)(32768 * proba); - - /* First Byte */ - BBuffer[pos++] = BMK_RANDCHAR; - - while (pos < bufferSize) - { - /* Select : Literal (noise) or copy (within 64K) */ - if (BMK_RAND15BITS < P32) - { - /* Match */ - size_t match, end; - unsigned length = BMK_RANDLENGTH + 4; - unsigned offset = BMK_RAND15BITS + 1; - if (offset > pos) offset = pos; - match = pos - offset; - end = pos + length; - if (end > bufferSize) end = bufferSize; - while (pos < end) BBuffer[pos++] = BBuffer[match++]; - } - else - { - /* Literal */ - size_t end; - unsigned length = BMK_RANDLENGTH; - end = pos + length; - if (end > bufferSize) end = bufferSize; - while (pos < end) BBuffer[pos++] = BMK_RANDCHAR; - } - } -} -#endif - /********************************************************* * Benchmark wrappers *********************************************************/ @@ -515,8 +460,8 @@ int benchSample(U32 benchNb) } /* Fill buffer */ - BMK_datagen(origBuff, benchedSize, g_compressibilityDefault, 0); - //RDG_generate(benchedSize, 0, g_compressibilityDefault, g_compressibilityDefault / 3.6); + //BMK_datagen(origBuff, benchedSize, g_compressibilityDefault, 0); + RDG_genBuffer(origBuff, benchedSize, g_compressibilityDefault, 0.0, 0); /* bench */ DISPLAY("\r%79s\r", "");