Reduce hasher lookups with good matches

This commit is contained in:
Martin Raszyk 2018-09-26 21:33:55 +02:00
parent 6eba239a5b
commit 352b7a01e9

View File

@ -47,10 +47,11 @@ static BROTLI_NOINLINE void EXPORT_FN(CreateBackwardReferences)(
params->dist.max_distance, &sr);
if (sr.score > kMinScore) {
/* Found a match. Let's look for something even better ahead. */
const score_t cost_diff_lazy = 175;
int delayed_backward_references_in_row = 0;
--max_length;
for (;; --max_length) {
const score_t cost_diff_lazy = 175;
for (; BackwardReferenceScoreUsingLastDistance(pos_end - (position + 1))
>= sr.score + cost_diff_lazy; --max_length) {
HasherSearchResult sr2;
sr2.len = params->quality < MIN_QUALITY_FOR_EXTENSIVE_REFERENCE_SEARCH ?
BROTLI_MIN(size_t, sr.len - 1, max_length) : 0;