Re: [PATCH] ls-refs: reuse buffer when sending refs
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Aug 25, 2021, 14:10 UTC
- Message-ID
- <YSZPUYk5J10DID+7@ncase>
- In-Reply-To
- <ccd03e685af0f5cf25c68272a758fc88d115e37a.1629899211.git.ps@pks.im>
On Wed, Aug 25, 2021 at 03:49:51PM +0200, Patrick Steinhardt wrote:
Show 23 quoted lines
> In the initial reference advertisement, the Git server will first > announce all of its references to the client. The logic is handled in > `send_ref()`, which will allocate a new buffer for each refline it is > about to send. This is quite wasteful: instead of allocating a new > buffer each time, we can just reuse a buffer. > > Improve this by passing in a buffer via the `ls_refs_data` struct which > is then reused on each reference. In a repository with about 2.3M refs, > this speeds up local mirror fetches by about 2%: > > Benchmark #1: HEAD~: git-fetch > Time (mean ± σ): 25.415 s ± 0.131 s [User: 22.722 s, System: 4.740 s] > Range (min … max): 25.240 s … 25.543 s 5 runs > > Benchmark #2: HEAD: git-fetch > Time (mean ± σ): 24.922 s ± 0.110 s [User: 22.404 s, System: 4.476 s] > Range (min … max): 24.825 s … 25.081 s 5 runs > > Summary > 'HEAD: git-fetch' ran > 1.02 ± 0.01 times faster than 'HEAD~: git-fetch' > > Signed-off-by: Patrick Steinhardt <ps@kps.im>
I accidentally mis-typed my mail here. Really shows I should be using `--signoff` instead of manually signing things. Anyway, I'll fix this in case I'll need to re-roll.
Patrick