summaryrefslogtreecommitdiff
path: root/t/t4018/bash-posix-style-single-command-function
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2025-09-02 20:24:52 +0200
committerJunio C Hamano <gitster@pobox.com>2025-09-02 15:15:13 -0700
commit30598ccc4d93bb235e0807c04835cd00ba63577b (patch)
treec735d7a47a490764810de565c6ed33eaa1010046 /t/t4018/bash-posix-style-single-command-function
parent08bb69d70f55cb6b44cdc6aefa7bc1d9cf4eb3f3 (diff)
describe: use oidset in finish_depth_computation()
Depth computation can end early if all remaining commits are flagged. The current code determines if that's the case by checking all queue items each time it dequeues a flagged commit. This can cause quadratic complexity. We could simply count the flagged items in the queue and then update that number as we add and remove items. That would provide a general speedup, but leave one case where we have to scan the whole queue: When we flag a previously seen, but unflagged commit. It could be on the queue and then we'd have to decrease our count. We could dedicate an object flag to track queue membership, but that would leave less for candidate tags, affecting the results. So use a hash table, specifically an oidset of commit hashes, to track that. This avoids quadratic behaviour in all cases and provides a nice performance boost over the previous commit, 08bb69d70f (describe: use prio_queue_replace(), 2025-08-03): Benchmark 1: ./git_08bb69d70f describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 855.3 ms ± 1.3 ms [User: 790.8 ms, System: 49.9 ms] Range (min … max): 853.7 ms … 857.8 ms 10 runs Benchmark 2: ./git describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 610.8 ms ± 1.7 ms [User: 546.9 ms, System: 49.3 ms] Range (min … max): 608.9 ms … 613.3 ms 10 runs Summary ./git describe $(git rev-list v2.41.0..v2.47.0) ran 1.40 ± 0.00 times faster than ./git_08bb69d70f describe $(git rev-list v2.41.0..v2.47.0) Helped-by: Jeff King <peff@peff.net> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018/bash-posix-style-single-command-function')
0 files changed, 0 insertions, 0 deletions