MCPcopy Create free account
hub / github.com/F-Stack/f-stack / FIO_adjustParamsForPatchFromMode

Function FIO_adjustParamsForPatchFromMode

freebsd/contrib/zstd/programs/fileio.c:900–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898} cRess_t;
899
900static void FIO_adjustParamsForPatchFromMode(FIO_prefs_t* const prefs,
901 ZSTD_compressionParameters* comprParams,
902 unsigned long long const dictSize,
903 unsigned long long const maxSrcFileSize,
904 int cLevel)
905{
906 unsigned const fileWindowLog = FIO_highbit64(maxSrcFileSize) + 1;
907 ZSTD_compressionParameters const cParams = ZSTD_getCParams(cLevel, (size_t)maxSrcFileSize, (size_t)dictSize);
908 FIO_adjustMemLimitForPatchFromMode(prefs, dictSize, maxSrcFileSize);
909 if (fileWindowLog > ZSTD_WINDOWLOG_MAX)
910 DISPLAYLEVEL(1, "Max window log exceeded by file (compression ratio will suffer)\n");
911 comprParams->windowLog = MIN(ZSTD_WINDOWLOG_MAX, fileWindowLog);
912 if (fileWindowLog > ZSTD_cycleLog(cParams.chainLog, cParams.strategy)) {
913 if (!prefs->ldmFlag)
914 DISPLAYLEVEL(1, "long mode automatically triggered\n");
915 FIO_setLdmFlag(prefs, 1);
916 }
917 if (cParams.strategy >= ZSTD_btopt) {
918 DISPLAYLEVEL(1, "[Optimal parser notes] Consider the following to improve patch size at the cost of speed:\n");
919 DISPLAYLEVEL(1, "- Use --single-thread mode in the zstd cli\n");
920 DISPLAYLEVEL(1, "- Set a larger targetLength (eg. --zstd=targetLength=4096)\n");
921 DISPLAYLEVEL(1, "- Set a larger chainLog (eg. --zstd=chainLog=%u)\n", ZSTD_CHAINLOG_MAX);
922 DISPLAYLEVEL(1, "Also consdier playing around with searchLog and hashLog\n");
923 }
924}
925
926static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
927 const char* dictFileName, unsigned long long const maxSrcFileSize,

Callers 1

FIO_createCResourcesFunction · 0.85

Calls 5

FIO_highbit64Function · 0.85
FIO_setLdmFlagFunction · 0.85
ZSTD_getCParamsFunction · 0.50
ZSTD_cycleLogFunction · 0.50

Tested by

no test coverage detected