summaryrefslogtreecommitdiff
path: root/diff.h
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-03-30 00:31:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-30 16:59:53 (GMT)
commite3696980163bdbd3bc56e5ffc69e8770015f366f (patch)
treecf50d1beba279fbfca4d628aa23de5defdbabe1d /diff.h
parented591febb4a201ce48b34a4e90027414cd0d7966 (diff)
downloadgit-e3696980163bdbd3bc56e5ffc69e8770015f366f.zip
git-e3696980163bdbd3bc56e5ffc69e8770015f366f.tar.gz
git-e3696980163bdbd3bc56e5ffc69e8770015f366f.tar.bz2
diff: halt tree-diff early after max_changes
When computing the changed-paths bloom filters for the commit-graph, we limit the size of the filter by restricting the number of paths in the diff. Instead of computing a large diff and then ignoring the result, it is better to halt the diff computation early. Create a new "max_changes" option in struct diff_options. If non-zero, then halt the diff computation after discovering strictly more changed paths. This includes paths corresponding to trees that change. Use this max_changes option in the bloom filter calculations. This reduces the time taken to compute the filters for the Linux kernel repo from 2m50s to 2m35s. On a large internal repository with ~500 commits that perform tree-wide changes, the time reduced from 6m15s to 3m48s. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Garima Singh <garima.singh@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.h')
-rw-r--r--diff.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/diff.h b/diff.h
index 6febe7e..9443dc1 100644
--- a/diff.h
+++ b/diff.h
@@ -285,6 +285,11 @@ struct diff_options {
/* Number of hexdigits to abbreviate raw format output to. */
int abbrev;
+ /* If non-zero, then stop computing after this many changes. */
+ int max_changes;
+ /* For internal use only. */
+ int num_changes;
+
int ita_invisible_in_index;
/* white-space error highlighting */
#define WSEH_NEW (1<<12)