diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Diff without asking xdiff for a minimal result
XDF_NEED_MINIMAL turns off the cost limit in xdiff, so a file whose
lines were reordered took time quadratic in its length: 2.1 s for one of
40000 lines, now 38 ms. Git leaves it off by default as well.
Diffstat (limited to 'source/shared.c')
| -rw-r--r-- | source/shared.c | 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 3 insertions, 1 deletion
diff --git a/source/shared.c b/source/shared.c index 51c92d4..0bd9fe3 100644 --- a/source/shared.c +++ b/source/shared.c @@ -435,7 +435,9 @@ int cgit_diff_files(const struct object_id *old_oid, const struct object_id *new memset(&diff_params, 0, sizeof(diff_params)); memset(&emit_params, 0, sizeof(emit_params)); memset(&emit_cb, 0, sizeof(emit_cb)); - diff_params.flags = XDF_NEED_MINIMAL; + // Without XDF_NEED_MINIMAL, as git diffs by default: on a file whose + // lines were reordered, a minimal diff costs time quadratic in its + // length. if (ignorews) diff_params.flags |= XDF_IGNORE_WHITESPACE; emit_params.ctxlen = context > 0 ? context : DEFAULT_DIFF_CONTEXT; |
