commit-graph: examine commits by generation number
authorGarima Singh <garima.singh@microsoft.com>
Mon, 30 Mar 2020 00:31:30 +0000 (00:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2020 16:59:53 +0000 (09:59 -0700)
commit3d11275505694ce4e5256516de1c5dd90e749303
treec77b74cd3922bcc8039703ff7db50d1d073db723
parentd21ee7d111073dfd7a86f6fe870d0c1ec6a07126
commit-graph: examine commits by generation number

When running 'git commit-graph write --changed-paths', we sort the
commits by pack-order to save time when computing the changed-paths
bloom filters. This does not help when finding the commits via the
'--reachable' flag.

If not using pack-order, then sort by generation number before
examining the diff. Commits with similar generation are more likely
to have many trees in common, making the diff faster.

On the Linux kernel repository, this change reduced the computation
time for 'git commit-graph write --reachable --changed-paths' from
3m00s to 1m37s.

Helped-by: Jeff King <peff@peff.net>
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>
commit-graph.c