| 898 | } cRess_t; |
| 899 | |
| 900 | static 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 | |
| 926 | static cRess_t FIO_createCResources(FIO_prefs_t* const prefs, |
| 927 | const char* dictFileName, unsigned long long const maxSrcFileSize, |
no test coverage detected