Overview
SHA1 Hash: | b816fadfc76c2e7b00da9ed2c23a8dfdddd6a7b8 |
---|---|
Date: | 2007-09-05 18:46:59 |
User: | drh |
Comment: | Fix pathological N*2 behavior in the delta generator. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/delta.c from [4f6e9c70e9] to [d84dda2bcd].
@@ -340,15 +340,16 @@ hash_init(&h, &zOut[base]); i = 0; /* Trying to match a landmark against zOut[base+i] */ bestCnt = 0; while( 1 ){ int hv; + int limit = 50; hv = hash_32bit(&h) & (MX_LANDMARK-1); DEBUG2( printf("LOOKING: %4d [%s]\n", base+i, print16(&zOut[base+i])); ) iBlock = landmark[hv]; - while( iBlock>=0 ){ + while( iBlock>=0 && (limit--)>0 ){ /* ** The hash window has identified a potential match against ** landmark block iBlock. But we need to investigate further. ** ** Look for a region in zOut that matches zSrc. Anchor the search @@ -404,11 +405,11 @@ } /* We have a copy command that does not cause the delta to be larger ** than a literal insert. So add the copy command to the delta. */ - if( bestCnt>0 && base+i>=bestOfst+NHASH ){ + if( bestCnt>0 ){ if( bestLitsz>0 ){ /* Add an insert command before the copy */ putInt(bestLitsz,&zDelta); *(zDelta++) = ':'; memcpy(zDelta, &zOut[base], bestLitsz);
Deleted test/basic1.test version [d90e14fae8]