path: root/merge-file.c
diff options
authorRené Scharfe <>2010-05-02 13:04:41 (GMT)
committerJunio C Hamano <>2010-05-02 14:59:50 (GMT)
commit582aa00bdffb27abcf1b27d541b4c231a395d3b8 (patch)
tree4dc75d74940955a17d0b3c2e4e61e55034dd8ab3 /merge-file.c
parented215b109fc0e352456ea2ef6a0f8375e28466d5 (diff)
git diff too slow for a file
Ever since the xdiff library had been introduced to git, all its callers have used the flag XDF_NEED_MINIMAL. It makes sure that the smallest possible diff is produced, but that takes quite some time if there are lots of differences that can be expressed in multiple ways. This flag makes a difference for only 0.1% of the non-merge commits in the git repo of Linux, both in terms of diff size and execution time. The patches there are mostly nice and small. SungHyun Nam however reported a case in a different repo where a diff took more than 20 times longer to generate with XDF_NEED_MINIMAL than without. Rebasing became really slow. This patch removes this flag from all callers. The default of xdiff is saner because it has minimal to no impact in the normal case of small diffs and doesn't incur that much of a speed penalty for large ones. A follow-up patch may introduce a command line option to set the flag if the user needs it, similar to GNU diff's -d/--minimal. Signed-off-by: Rene Scharfe <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'merge-file.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/merge-file.c b/merge-file.c
index fd34d76..cafc274 100644
--- a/merge-file.c
+++ b/merge-file.c
@@ -60,7 +60,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)
xdemitcb_t ecb;
memset(&xpp, 0, sizeof(xpp));
- xpp.flags = XDF_NEED_MINIMAL;
+ xpp.flags = 0;
memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 3;
xecfg.flags = XDL_EMIT_COMMON;