Re: [PATCH v2 2/2] fetch: skip computing output width when not printing anything
From: Christian Couder <hidden>
Date: 2022-02-09 18:10:53
On Wed, Feb 2, 2022 at 5:13 PM Patrick Steinhardt [off-list ref] wrote:
Skip computing the summary width when the user asked for us to be quiet.
There is a --quiet option for git fetch, so here we can expect that it will be used to test this speedup...
This gives us a small speedup of nearly 10% when doing a dry-run
mirror-fetch in a repository with thousands of references being updated:
Benchmark 1: git fetch --prune --dry-run +refs/*:refs/* (HEAD~)
Time (mean ± σ): 34.048 s ± 0.233 s [User: 30.739 s, System: 4.640 s]
Range (min … max): 33.785 s … 34.296 s 5 runs
Benchmark 2: git fetch --prune --dry-run +refs/*:refs/* (HEAD)
Time (mean ± σ): 30.768 s ± 0.287 s [User: 27.534 s, System: 4.565 s]
Range (min … max): 30.432 s … 31.181 s 5 runs
Summary
'git fetch --prune --dry-run +refs/*:refs/* (HEAD)' ran
1.11 ± 0.01 times faster than 'git fetch --prune --dry-run +refs/*:refs/* (HEAD~)'...but --prune and --dry-run are used for testing. It would be nice if this discrepancy was explained a bit. Otherwise the commit message and code look good to me.