Re: [PATCH] [GSOC] ref-filter: use single strbuf for all output
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Apr 6, 2021, 08:58 UTC
- Message-ID
- <CAOLTT8RB-Ky70Z_JOEAbKSpRwmvNwF9ecikD4ThOorZ=Ne-LTg@mail.gmail.com>
- In-Reply-To
- <50fce64e-d3f5-05e6-5e2a-645864211176@gmail.com>
Derrick Stolee <stolee@gmail.com> 于2021年4月6日周二 上午5:02写道:
Show 34 quoted lines
> > On 4/5/2021 10:01 AM, ZheNing Hu via GitGitGadget wrote: > > 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/ > > > 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: >
Thanks! But now it may still need more experimental examples to prove that this optimization is visible.
Show 20 quoted lines
> The performance for 'git for-each-ref' on the Git > repository itself with X references changes from > 3.2 seconds to 2.9 seconds. > > > 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. >
OK, I will do it.
> I found the code change to be correct. Thanks! > -Stolee
Thanks. -- ZheNing Hu