Truing to use JS `eval' in several ways doesn't seem to be doing
anything for speed. So dump all attempts at making things faster this way. Also, it seems that things are responsive enough with any break in the searching "thread", so shorten that time. (And one other random optimization: abort early when an item doesn't match.) svn: r16943
This commit is contained in:
parent
fbf7f79d8c
commit
128da973df
|
@ -439,20 +439,21 @@ function Search(data, term, is_pre, K) {
|
||||||
var r, min = C_max, max = C_min;
|
var r, min = C_max, max = C_min;
|
||||||
for (var j=0; j<preds.length; j++) {
|
for (var j=0; j<preds.length; j++) {
|
||||||
r = preds[j](data[i]); min = Math.min(r, min); max = Math.max(r, max);
|
r = preds[j](data[i]); min = Math.min(r, min); max = Math.max(r, max);
|
||||||
|
if (min <= C_min) break; // get out if it's hopeless
|
||||||
}
|
}
|
||||||
if (max >= C_rexact && min >= C_exact) exacts.push(data[i]);
|
if (max >= C_rexact && min >= C_exact) exacts.push(data[i]);
|
||||||
else if (min > C_wordmatch) matches.push(data[i]);
|
else if (min > C_wordmatch) matches.push(data[i]);
|
||||||
else if (min > C_fail) wordmatches.push(data[i]);
|
else if (min > C_fail) wordmatches.push(data[i]);
|
||||||
fuel--; i++;
|
fuel--; i++;
|
||||||
}
|
}
|
||||||
if (i<data.length) t = setTimeout(DoChunk,15);
|
if (i<data.length) t = setTimeout(DoChunk,5);
|
||||||
else {
|
else {
|
||||||
r = [exacts.length, exacts.concat(matches).concat(wordmatches)];
|
r = [exacts.length, exacts.concat(matches).concat(wordmatches)];
|
||||||
if (K) K(r); else return r;
|
if (K) K(r); else return r;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!K) return DoChunk();
|
if (!K) return DoChunk();
|
||||||
else { progress(0); t = setTimeout(DoChunk,15); return killer; }
|
else { progress(0); t = setTimeout(DoChunk,5); return killer; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetContextHTML() {
|
function GetContextHTML() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user