summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2025-10-24 18:47:10 +0200
committerJunio C Hamano <gitster@pobox.com>2025-10-24 10:13:17 -0700
commit134ec330d2945002d0ceb7de2ac6cd7ab0af762d (patch)
treedf8145a78d96e4eff0460dd674afaaed69b67834 /cache-tree.c
parent81f86aacc4eb74cdb9c2c8082d36d2070c666045 (diff)
commit-reach: avoid commit_list_insert_by_date()
Building a list using commit_list_insert_by_date() has quadratic worst case complexity. Avoid it by just appending in the loop and sorting at the end. The number of merge bases is usually small, so don't expect speedups in normal repositories. It has no limit, though. The added perf test shows a nice improvement when dealing with 16384 merge bases: Test v2.51.1 HEAD ----------------------------------------------------------------- 6010.2: git merge-base 0.55(0.54+0.00) 0.03(0.02+0.00) -94.5% Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.c')
0 files changed, 0 insertions, 0 deletions