Re: [PATCH] [GSOC] ref-filter: use single strbuf for all output
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Apr 5, 2021, 21:02 UTC
- Message-ID
- <50fce64e-d3f5-05e6-5e2a-645864211176@gmail.com>
- In-Reply-To
- <pull.927.git.1617631280402.gitgitgadget@gmail.com>
On 4/5/2021 10:01 AM, ZheNing Hu via GitGitGadget wrote:
Show 6 quoted lines
> From: ZheNing Hu <adlternative@gmail.com> > > When we use `git for-each-ref`, every ref will call > `show_ref_array_item()` and allocate its own final strbuf > and error strbuf. Instead, we can provide two single strbuf: > final_buf and error_buf that get reused for each output.
s/two single strbuf/two buffers/
Show 19 quoted lines
> When run it 100 times: > > $ git for-each-ref > > on git.git : > > 3.19s user > 3.88s system > 35% cpu > 20.199 total > > to: > > 2.89s user > 4.00s system > 34% cpu > 19.741 total > > The performance has been slightly improved.
This is a nice amount of time! Perhaps simplify the presentation:
The performance for 'git for-each-ref' on the Git repository itself with X references changes from 3.2 seconds to 2.9 seconds.
Show 7 quoted lines
> Signed-off-by: ZheNing Hu <adlternative@gmail.com> > --- > [GSOC] ref-filter: use single strbuf for all output > > This patch learned Jeff King's optimization measures in git > cat-file(79ed0a5): using a single strbuf for all objects output Instead > of allocating a large number of small strbuf for every object.
This part of the cover letter could be put into the commit message itself. Use the correct formatting, though:
This approach is similar to the one used by 79ed0a5 (cat-file: use a single strbuf for all output, 2018-08-14) to speed up the cat-file builtin.
I found the code change to be correct. Thanks! -Stolee