git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Derrick StoleeNext: Jeff King
Message 5 of 21 in “[GSOC] ref-filter: use single strbuf for all output”
  1. [GSOC] ref-filter: use single strbuf for all outputZheNing Hu via GitGitGadget, Apr 5, 2021
  2. Eric SunshineApr 5, 2021
  3. ZheNing HuApr 6, 2021
  4. Derrick StoleeApr 5, 2021
  5. ZheNing HuApr 6, 2021
  6. Jeff KingApr 5, 2021
  7. ZheNing HuApr 6, 2021
  8. ZheNing HuApr 6, 2021
  9. Jeff KingApr 6, 2021
  10. ZheNing HuApr 6, 2021
  11. René ScharfeApr 6, 2021
  12. ZheNing HuApr 7, 2021
  13. [GSOC] ref-filter: use single strbuf for all outputZheNing Hu via GitGitGadget, Apr 7, 2021
  14. Junio C HamanoApr 7, 2021
  15. ZheNing HuApr 8, 2021
  16. Jeff KingApr 7, 2021
  17. ZheNing HuApr 8, 2021
  18. Jeff KingApr 8, 2021
  19. ZheNing HuApr 8, 2021
  20. Jeff KingApr 8, 2021
  21. ZheNing HuApr 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.