commit-graph: examine changed-path objects in pack order
commitd21ee7d111073dfd7a86f6fe870d0c1ec6a07126
authorJeff King <peff@peff.net>
Mon, 30 Mar 2020 00:31:29 +0000 (30 00:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2020 16:59:53 +0000 (30 09:59 -0700)
treeb0cc5b3a6bdd0ac55c39387d470290cdcf7cb70e
parentf97b9325f6d7ad2a28bfaf6fab3197d207fcb278
commit-graph: examine changed-path objects in pack order

Looking at the diff of commit objects in pack order is much faster than
in sha1 order, as it gives locality to the access of tree deltas
(whereas sha1 order is effectively random). Unfortunately the
commit-graph code sorts the commits (several times, sometimes as an oid
and sometimes a pointer-to-commit), and we ultimately traverse in sha1
order.

Instead, let's remember the position at which we see each commit, and
traverse in that order when looking at bloom filters. This drops my time
for "git commit-graph write --changed-paths" in linux.git from ~4
minutes to ~1.5 minutes.

Probably the "--reachable" code path would want something similar.

Or alternatively, we could use a different data structure (either a
hash, or maybe even just a bit in "struct commit") to keep track of
which oids we've seen, etc instead of sorting. And then we could keep
the original order.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Garima Singh <garima.singh@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c