From: Yann Collet Date: Sat, 14 Dec 2024 20:34:26 +0000 (-0800) Subject: fullbench: switch default generator to lorem ipsum X-Git-Tag: v1.5.7^2~48^2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac05ea89a5e87cf9e9756790f08b9d21b349fd9e;p=thirdparty%2Fzstd.git fullbench: switch default generator to lorem ipsum which creates more "realistic" scenarios than former compressible noise. The legacy data generator remains accessible, it is triggered when requesting an explicit compressibility factor (-P#). --- diff --git a/tests/Makefile b/tests/Makefile index 74e05774c..c10d66f53 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -150,12 +150,12 @@ $(FULLBENCHS) : LDFLAGS += $(MULTITHREAD_LD) $(FULLBENCHS) : DEBUGFLAGS = -DNDEBUG # turn off assert() for speed measurements $(FULLBENCHS) : DEBUGLEVEL = 0 # turn off assert() for speed measurements $(FULLBENCHS) : $(ZSTD_FILES) -$(FULLBENCHS) : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c +$(FULLBENCHS) : $(PRGDIR)/datagen.c $(PRGDIR)/lorem.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c $(LINK.c) $^ -o $@$(EXT) CLEAN += fullbench-lib fullbench-lib : CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(LIB_SRCDIR)/libzstd.a fullbench.c +fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/lorem.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(LIB_SRCDIR)/libzstd.a fullbench.c $(LINK.c) $^ -o $@$(EXT) # note : broken : requires symbols unavailable from dynamic library diff --git a/tests/fullbench.c b/tests/fullbench.c index ff512149a..889761ef4 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -33,6 +33,7 @@ #include "zstd.h" /* ZSTD_versionString */ #include "util.h" /* time functions */ #include "datagen.h" +#include "lorem.h" #include "benchfn.h" /* CustomBench */ #include "benchzstd.h" /* MB_UNIT */ @@ -50,7 +51,7 @@ #define DEFAULT_CLEVEL 1 -#define COMPRESSIBILITY_DEFAULT 0.50 +#define COMPRESSIBILITY_DEFAULT (-1.0) static const size_t kSampleSizeDefault = 10000000; #define TIMELOOP_NANOSEC (1*1000000000ULL) /* 1 second */ @@ -754,6 +755,11 @@ _cleanOut: #define BENCH_ALL_SCENARIOS 999 +/* + * if @compressibility < 0.0, use Lorem Ipsum generator + * otherwise, @compressibility is expected to be between 0.0 and 1.0 + * if scenarioID == BENCH_ALL_SCENARIOS, all scenarios will be run on the sample +*/ static int benchSample(U32 scenarioID, size_t benchedSize, double compressibility, int cLevel, ZSTD_compressionParameters cparams) @@ -763,7 +769,12 @@ static int benchSample(U32 scenarioID, if (!origBuff) { DISPLAY("\nError: not enough memory!\n"); return 12; } /* Fill buffer */ - RDG_genBuffer(origBuff, benchedSize, compressibility, 0.0, 0); + if (compressibility < 0.0) { + LOREM_genBuffer(origBuff, benchedSize, 0); + } else { + RDG_genBuffer(origBuff, benchedSize, compressibility, 0.0, 0); + + } /* bench */ DISPLAY("\r%70s\r", "");