diff options
author | Antoni Adaszkiewicz <a.adaszkiewi@samsung.com> | 2022-08-05 12:41:39 +0200 |
---|---|---|
committer | Antoni Adaszkiewicz <a.adaszkiewi@samsung.com> | 2022-08-05 17:24:24 +0200 |
commit | 459dcf165dedc708571aa764e112c193f135ced1 (patch) | |
tree | e2a9c6953cf2aae38aa65f83b5b47cd705077710 | |
parent | ecf33dbae555f6f58686e4ccfc0ce83f77141133 (diff) | |
download | libtota-459dcf165dedc708571aa764e112c193f135ced1.tar.gz libtota-459dcf165dedc708571aa764e112c193f135ced1.tar.bz2 libtota-459dcf165dedc708571aa764e112c193f135ced1.zip |
ss_bsdiff: Change the logic of timing out when creating deltas takes too long.
Even for files 100MB in size ss_bsdiff could sometimes take up to 30mins
on my machine(i7-6700, x86_64). No matter what we want deltas to be created, this
is why for the last try timeout will be disabled.
Change-Id: I495c091efd4f62037b14d6dca58aa12346f6a87b
-rwxr-xr-x | bsdiff/ss_bsdiff.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bsdiff/ss_bsdiff.c b/bsdiff/ss_bsdiff.c index 2083ab2..a01aa89 100755 --- a/bsdiff/ss_bsdiff.c +++ b/bsdiff/ss_bsdiff.c @@ -57,7 +57,7 @@ #define CONST_MEMORY_USAGE 16384 // patch in m+O(1); m=size of new file; use only const memory for old file at patch side; #define PATCH_FILE_FORMAT_MOD // no accumulation of diff and extra in db and eb; immediate write; also write all 3 parts of control stmt at same time #define MULTI_THREADING 1 // only with #define CONST_MEMORY_USAGE or #define MAX_MATCH_SIZE -#define TIME_LIMIT_CHECK 300 +#define TIME_LIMIT_CHECK 300 // After TIME_LIMIT_CHECK seconds, new diff will be created with smaller score argument #define TEMP_PATCH_NAME "temp_patch" #define BROTLI_COMPRESSION_QUALITY 9 #define ITERATIONS_COMPLETED 10 // After ITERATIONS_COMPLETED iterations elapsed time will be checked. Increasing it can cause the program to run longer than expected @@ -371,7 +371,8 @@ int Function(int offset_oldscore) (data.old[scsc + lastoffset] == data.new[thread_num][scsc])) oldscore++; #ifdef TIME_LIMIT_CHECK - outer_count++; + if (offset_oldscore != 0) // when offset_oldscore is 0 we have to make sure diff is created no mater what, so we can't timeout + outer_count++; if (outer_count > ITERATIONS_COMPLETED) { outer_count = 0; get_time_stamp(); //total time capturing |