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

Re: [PATCH 2/2] builtin/repo: don't fully parse trees

From
Derrick Stolee <stolee@gmail.com>
Date
Nov 16, 2026, 13:43 UTC
Message-ID
<0b4f65e1-bebc-4dcd-961d-42da1fe02a77@gmail.com>
In-Reply-To
<20261113-pks-repo-count-objects-speedup-v1-2-7ba4f29e74fb@pks.im>
On 11/13/2026 6:46 AM, Patrick Steinhardt wrote:
Show 11 quoted lines
> 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

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 15 in “builtin/repo: improve counting of objects”
  1. 0/2 builtin/repo: improve counting of objectsPatrick Steinhardt, Nov 13, 2026
  2. 1/2 builtin/repo: only parse objects as neededPatrick Steinhardt, Nov 13, 2026
  3. Kristofer KarlssonNov 13, 2026
  4. Patrick SteinhardtNov 16, 2026
  5. Kristofer KarlssonNov 16, 2026
  6. 2/2 builtin/repo: don't fully parse treesPatrick Steinhardt, Nov 13, 2026
  7. Kristofer KarlssonNov 13, 2026
  8. Patrick SteinhardtNov 16, 2026
  9. Derrick StoleeNov 16, 2026
  10. 0/2 builtin/repo: improve counting of objectsPatrick Steinhardt, Nov 16, 2026
  11. 1/2 builtin/repo: only parse objects as neededPatrick Steinhardt, Nov 16, 2026
  12. 2/2 builtin/repo: don't fully parse treesPatrick Steinhardt, Nov 16, 2026
  13. Kristofer KarlssonNov 16, 2026
  14. Derrick StoleeNov 16, 2026
  15. Junio C HamanoNov 16, 2026

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.