Re: [PATCH v2 2/2] fetch: skip computing output width when not printing anything
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Feb 9, 2022, 18:10 UTC
- Message-ID
- <CAP8UFD0r2ZnGCAjkQcLfEZCvxHVFGSWeAC7vSat7V7-=rhiGeQ@mail.gmail.com>
- In-Reply-To
- <4b9bbcf7958da6db2be771f910974a6bffb2d94a.1643806143.git.ps@pks.im>
On Wed, Feb 2, 2022 at 5:13 PM Patrick Steinhardt <ps@pks.im> 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...
Show 14 quoted lines
> 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.