All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: ZheNing Hu <adlternative@gmail.com>
Cc: "Git List" <git@vger.kernel.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Christian Couder" <christian.couder@gmail.com>
Subject: Re: [GSOC][QUESTION] How to parse the properties of the object at once
Date: Sat, 07 Aug 2021 00:15:20 -0700	[thread overview]
Message-ID: <xmqqzgttiv3r.fsf@gitster.g> (raw)
In-Reply-To: <CAOLTT8Q8BEKCVwPDypW1w66P9_xP7QC0T-CnLqamqAL4haGzwA@mail.gmail.com> (ZheNing Hu's message of "Sat, 7 Aug 2021 14:32:51 +0800")

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.



      reply	other threads:[~2021-08-07  7:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07  6:32 [GSOC][QUESTION] How to parse the properties of the object at once ZheNing Hu
2021-08-07  7:15 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzgttiv3r.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=adlternative@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.