}
}
- //prints out tradeoff table if using lvloptimize
if(g_optmode && g_optimizer && (DEBUG || g_displayLevel == 3)) {
winnerInfo_t w;
winner_ll_node* n;
/* inits memotables for all (including mallocs), all strategies */
/* takes unsanitized varyParams */
-static memoTable_t* createMemoTableArray(const varInds_t* const varyParams, const size_t varyLen, U32 memoTableLog) {
+static memoTable_t* createMemoTableArray(const paramValues_t p, const varInds_t* const varyParams, const size_t varyLen, const U32 memoTableLog) {
memoTable_t* mtAll = (memoTable_t*)calloc(sizeof(memoTable_t),(ZSTD_btultra + 1));
- int i;
+ ZSTD_strategy i, stratMin = ZSTD_fast, stratMax = ZSTD_btultra;
if(mtAll == NULL) {
return NULL;
return mtAll;
}
- /* hash table if normal table is too big */
- for(i = 1; i <= (int)ZSTD_btultra; i++) {
+
+ if(p.vals[strt_ind] != PARAM_UNSET) {
+ stratMin = p.vals[strt_ind];
+ stratMax = p.vals[strt_ind];
+ }
+
+
+ for(i = stratMin; i <= stratMax; i++) {
size_t mtl = memoTableLen(mtAll[i].varArray, mtAll[i].varLen);
mtAll[i].tableType = directMap;
int i;
for(i = 0; i < NUM_PARAMS; i++) {
varInds_t v = mt.varArray[i];
- if(v == strt_ind) continue; //skip, already specified
+ if(v == strt_ind) continue;
pc->vals[v] = rangeMap(v, FUZ_rand(&g_rand) % rangetable[v]);
}
- if(!(memoTableGet(memoTableArray, *pc))) break; //only pick unpicked params.
+ if(!(memoTableGet(memoTableArray, *pc))) break; /* only pick unpicked params. */
}
}
for(i = 0; i < tries; i++) {
DEBUGOUTPUT("Restart\n");
- do { randomConstrainedParams(&init, memoTableArray, strat); } while(redundantParams(init, target, buf.maxBlockSize)); //only non-redundant params
+ do { randomConstrainedParams(&init, memoTableArray, strat); } while(redundantParams(init, target, buf.maxBlockSize));
candidateInfo = climbOnce(target, memoTableArray, buf, ctx, init);
if(compareResultLT(winnerInfo.result, candidateInfo.result, target, buf.srcSize)) {
winnerInfo = candidateInfo;
#define TRY_DECAY 1
static int optimizeForSize(const char* const * const fileNamesTable, const size_t nbFiles, const char* dictFileName, constraint_t target, paramValues_t paramTarget,
- int cLevelOpt, int cLevelRun, U32 memoTableLog)
+ const int cLevelOpt, const int cLevelRun, const U32 memoTableLog)
{
varInds_t varArray [NUM_PARAMS];
int ret = 0;
optimizerAdjustInput(¶mTarget, buf.maxBlockSize);
paramBase = cParamUnsetMin(paramTarget);
- // TODO: if strategy is fixed, only init that row
- allMT = createMemoTableArray(varArray, varLen, memoTableLog);
+ allMT = createMemoTableArray(paramTarget, varArray, varLen, memoTableLog);
if(!allMT) {
DISPLAY("MemoTable Init Error\n");