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

Re: Git in Outreachy?

From
ZheNing Hu <adlternative@gmail.com>
Date
Sep 5, 2021, 08:58 UTC
Message-ID
<CAOLTT8S1Tfu6YWcoHhZcydQYd_yBBCavdqyV_TzoOrEW6zHXGQ@mail.gmail.com>
In-Reply-To
<YTNrehKnfPo3E5RI@coredump.intra.peff.net>
Jeff King <peff@peff.net> 于2021年9月4日周六 下午8:50写道:
Show 22 quoted lines
>
> On Sat, Sep 04, 2021 at 03:40:41PM +0800, ZheNing Hu wrote:
>
> > This may be a place to promote my patches: See [1][2][3].
> > It can provide some extra atoms for git cat-file --batch | --batch-check,
> > like %(tree), %(author), %(tagger) etc. Although some performance
> > optimizations have been made, It still has small performance gap.
> >
> > If the community still expects git cat-file --batch to reuse the logic
> > of ref-filter,
> > I expect it to get the attention of reviewers.
> >
> > The solutions I can think of to further optimize performance are:
> > 1. Delay the evaluation of some ref-filter intermediate data.
> > 2. Let ref-filter code reentrant and can be called in multi-threaded  to take
> > advantage of multi-core.
>
> I don't think trying to thread it will help much. For expensive formats,
> where we have to actually open and parse objects, in theory we could do
> that in parallel. But most of our time there is spent in zlib getting
> the object data, and that all needs to be done under a big lock.
>

This big lock is "obj_read_lock()", right? If there are indeed the limitations of these locks, I am afraid that the parallel scheme is not good.

> For little formats (e.g., just printing "%(refname)"), we need to
> serialize the output anyway. So our unit of work is so tiny, I suspect
> that the threading overhead would be a net negative.
>
Make sence.
> I was coincidentally looking at ref-filter last week, and it seemed to
> me that a lot of the slowness is because of the over-use of malloc

Agree. malloc() and data-copy is the reason for the poor performance of ref-filter.

Show 6 quoted lines
> (e.g., we allocate a substring for every atom_value, and then form them
> into a separate buffer). If we could parse the original format into a
> form that could be traversed without having to do further allocations,
> just writing directly to a strbuf (or even a file handle), I think that
> would be a big improvement.
>

This patch has been tried to eliminate some malloc and data-copy: https://lore.kernel.org/git/3760ff032bb1dec3812881fd408f8d78ec125477.1629184489.git.gitgitgadget@gmail.com/ It is indeed possible to obtain some optimizations.

Show 9 quoted lines
> I just posted the results of some of my experiments to the list:
>
>   https://lore.kernel.org/git/YTNpQ7Od1U%2F5i0R7@coredump.intra.peff.net/
>
> I don't think that gives any kind of useful base to build on, but it
> shows what's possible by skipping past various segments of the
> ref-filter code.
>
> -Peff

Thanks. -- ZheNing Hu

Previous: Jeff KingNext: Matheus Tavares Bernardino
Message 6 of 23 in “Git in Outreachy?”
  1. Taylor BlauSep 3, 2021
  2. Emily ShafferSep 3, 2021
  3. Christian CouderSep 4, 2021
  4. ZheNing HuSep 4, 2021
  5. Jeff KingSep 4, 2021
  6. ZheNing HuSep 5, 2021
  7. Matheus Tavares BernardinoSep 6, 2021
  8. ZheNing HuSep 7, 2021
  9. Taylor BlauSep 4, 2021
  10. Taylor BlauSep 18, 2021
  11. ZheNing HuSep 20, 2021
  12. Christian CouderSep 20, 2021
  13. Christian CouderSep 20, 2021
  14. ZheNing HuSep 21, 2021
  15. Christian CouderSep 21, 2021
  16. ZheNing HuSep 22, 2021
  17. ZheNing HuSep 21, 2021
  18. Christian CouderSep 21, 2021
  19. ZheNing HuSep 22, 2021
  20. Taylor BlauSep 21, 2021
  21. Christian CouderSep 29, 2021
  22. Taylor BlauSep 29, 2021
  23. Taylor BlauSep 29, 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.