diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-11-12 21:51:30 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-12 21:51:30 -0800 |
commit | ac2abb49ce1afdb0ba5b52bb18d04671a325c6c0 (patch) | |
tree | 3c095c76f8479f4cc701061a455c856651741246 /xdiff | |
parent | b2b80c107f6db4c3297af59fd2fb40ada5899778 (diff) | |
parent | 9b28d55401a529ff08c709f42f66e765c93b0a20 (diff) | |
download | git-ac2abb49ce1afdb0ba5b52bb18d04671a325c6c0.tar.gz |
Merge branch 'dl/xdiff'
* dl/xdiff:
xdiff: give up scanning similar lines early
Diffstat (limited to 'xdiff')
-rw-r--r-- | xdiff/xprepare.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c index e87ab57c65..a43aa72cd0 100644 --- a/xdiff/xprepare.c +++ b/xdiff/xprepare.c @@ -23,10 +23,9 @@ #include "xinclude.h" - #define XDL_KPDIS_RUN 4 #define XDL_MAX_EQLIMIT 1024 - +#define XDL_SIMSCAN_WINDOW 100 typedef struct s_xdlclass { @@ -313,6 +312,18 @@ static int xdl_clean_mmatch(char const *dis, long i, long s, long e) { long r, rdis0, rpdis0, rdis1, rpdis1; /* + * Limits the window the is examined during the similar-lines + * scan. The loops below stops when dis[i - r] == 1 (line that + * has no match), but there are corner cases where the loop + * proceed all the way to the extremities by causing huge + * performance penalties in case of big files. + */ + if (i - s > XDL_SIMSCAN_WINDOW) + s = i - XDL_SIMSCAN_WINDOW; + if (e - i > XDL_SIMSCAN_WINDOW) + e = i + XDL_SIMSCAN_WINDOW; + + /* * Scans the lines before 'i' to find a run of lines that either * have no match (dis[j] == 0) or have multiple matches (dis[j] > 1). * Note that we always call this function with dis[i] > 1, so the |