diff options
author | Patrick Steinhardt <ps@pks.im> | 2021-08-09 10:11:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-09 09:51:12 -0700 |
commit | bf9c0cbddbcd730e4312ba5e19f8b8a2edd65bb3 (patch) | |
tree | 0387a4ad997b27b47dc52d5010135a7bed37001b /t/t0024-crlf-archive.sh | |
parent | connected: do not sort input revisions (diff) | |
download | tgif-bf9c0cbddbcd730e4312ba5e19f8b8a2edd65bb3.tar.xz |
revision: stop retrieving reference twice
When queueing up references for the revision walk, `handle_one_ref()`
will resolve the reference's object ID via `get_reference()` and then
queue the ID as pending object via `add_pending_oid()`. But given that
`add_pending_oid()` is only a thin wrapper around `add_pending_object()`
which fist calls `get_reference()`, we effectively resolve the reference
twice and thus duplicate some of the work.
Fix the issue by instead calling `add_pending_object()` directly, which
takes the already-resolved object as input. In a repository with lots of
refs, this translates into a near 10% speedup:
Benchmark #1: HEAD~: rev-list --unsorted-input --objects --quiet --not --all --not $newrev
Time (mean ± σ): 5.015 s ± 0.038 s [User: 4.698 s, System: 0.316 s]
Range (min … max): 4.970 s … 5.089 s 10 runs
Benchmark #2: HEAD: rev-list --unsorted-input --objects --quiet --not --all --not $newrev
Time (mean ± σ): 4.606 s ± 0.029 s [User: 4.260 s, System: 0.345 s]
Range (min … max): 4.565 s … 4.657 s 10 runs
Summary
'HEAD: rev-list --unsorted-input --objects --quiet --not --all --not $newrev' ran
1.09 ± 0.01 times faster than 'HEAD~: rev-list --unsorted-input --objects --quiet --not --all --not $newrev'
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0024-crlf-archive.sh')
0 files changed, 0 insertions, 0 deletions