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
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);
}
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);
#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;
}
-#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
*********************************************************/
}
/* 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", "");