mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'dl/xdiff'
* dl/xdiff: xdiff: give up scanning similar lines early
This commit is contained in:
commit
ac2abb49ce
|
@ -23,10 +23,9 @@
|
||||||
#include "xinclude.h"
|
#include "xinclude.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define XDL_KPDIS_RUN 4
|
#define XDL_KPDIS_RUN 4
|
||||||
#define XDL_MAX_EQLIMIT 1024
|
#define XDL_MAX_EQLIMIT 1024
|
||||||
|
#define XDL_SIMSCAN_WINDOW 100
|
||||||
|
|
||||||
|
|
||||||
typedef struct s_xdlclass {
|
typedef struct s_xdlclass {
|
||||||
|
@ -312,6 +311,18 @@ void xdl_free_env(xdfenv_t *xe) {
|
||||||
static int xdl_clean_mmatch(char const *dis, long i, long s, long e) {
|
static int xdl_clean_mmatch(char const *dis, long i, long s, long e) {
|
||||||
long r, rdis0, rpdis0, rdis1, rpdis1;
|
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
|
* 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).
|
* have no match (dis[j] == 0) or have multiple matches (dis[j] > 1).
|
||||||
|
|
Loading…
Reference in a new issue