Git development
 help / color / mirror / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] builtin/repo: don't fully parse trees
Date: Mon, 16 Nov 2026 08:43:17 -0500	[thread overview]
Message-ID: <0b4f65e1-bebc-4dcd-961d-42da1fe02a77@gmail.com> (raw)
In-Reply-To: <20261113-pks-repo-count-objects-speedup-v1-2-7ba4f29e74fb@pks.im>

On 11/13/2026 6:46 AM, Patrick Steinhardt wrote:
> When the rev walk hits a tree object we read its content and then parse
> it via `parse_object_buffer()`. This requires us to perform some extra
> bookkeeping that is ultimately unnecessary as we keep those trees in
> memory.
> 
> The only thing that we need the tree object's content for is so that we
> can count its entries. But that can easily be done without having a
> parsed tree object, all we need is its content.
> 
> Refactor the code accordingly, which gives us another significant
> speedup when executing `git repo structure` in "git.git":

>     Memory         3.4 GiB ±     0.0 GiB      3.4 GiB …     3.4 GiB
>     Memory         0.7 GiB ±     0.0 GiB      0.7 GiB …     0.7 GiB          -80.4%  (5.1x less)

This is an impressive memory reduction! Very nice.

(I'd comment on v2, but my email host must have bounced those.0

Thanks,
-Stolee


  parent reply	other threads:[~2026-11-16 13:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 11:46 [PATCH 0/2] builtin/repo: improve counting of objects Patrick Steinhardt
2026-11-13 11:46 ` [PATCH 1/2] builtin/repo: only parse objects as needed Patrick Steinhardt
2026-11-13 14:12   ` Kristofer Karlsson
2026-11-16  6:38     ` Patrick Steinhardt
2026-11-16  9:02       ` Kristofer Karlsson
2026-11-13 11:46 ` [PATCH 2/2] builtin/repo: don't fully parse trees Patrick Steinhardt
2026-11-13 14:15   ` Kristofer Karlsson
2026-11-16  6:39     ` Patrick Steinhardt
2026-11-16 13:43   ` Derrick Stolee [this message]
2026-11-16  8:01 ` [PATCH v2 0/2] builtin/repo: improve counting of objects Patrick Steinhardt
2026-11-16  8:01   ` [PATCH v2 1/2] builtin/repo: only parse objects as needed Patrick Steinhardt
2026-11-16  8:01   ` [PATCH v2 2/2] builtin/repo: don't fully parse trees Patrick Steinhardt
2026-11-16  9:07   ` [PATCH v2 0/2] builtin/repo: improve counting of objects Kristofer Karlsson
2026-11-16 16:02   ` Derrick Stolee
2026-11-16 17:32     ` Junio C Hamano

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=0b4f65e1-bebc-4dcd-961d-42da1fe02a77@gmail.com \
    --to=stolee@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox