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

Re: [GSOC][QUESTION] How to parse the properties of the object at once

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 7, 2021, 07:15 UTC
Message-ID
<xmqqzgttiv3r.fsf@gitster.g>
In-Reply-To
<CAOLTT8Q8BEKCVwPDypW1w66P9_xP7QC0T-CnLqamqAL4haGzwA@mail.gmail.com>
ZheNing Hu <adlternative@gmail.com> writes:
> This means that I shouldn't touch the content of struct commit. So I see the
> code of `commit-slab`, it seems that it is doing additional parsing.

We should keep what is in "struct commit" and parsing overhead to the minimum, as it matters to performance (especially when auxiliary data structures like commit-graph are not available for the part of history). If some pieces of data (like "from this byte to the end is %(body)") do not matter in commit traversal, they are optional, and (1) we should not always parse them out, instead we should do so only on demand, and (2) we should not add members for them in the commit object, but use commit slabs to store them.

As to the slab, it is not like you have to have a slab per these optional fields you may want to parse. If for example you need the authorship ident and timestamp, even if you do not need committer ident and timestamp, it is plausible to have a type of slab that holds these four data items together (and only fill parts of them that are actually requested by the callers). Also, things that are strings may want to be stored as a relative offset into the commit buffer, instead of duplicated copies of string values.

Previous: ZheNing Hu
Message 2 of 2 in “[GSOC][QUESTION] How to parse the properties of the object at once”
  1. ZheNing HuAug 7, 2021
  2. Junio C HamanoAug 7, 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.