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

Re: [PATCH 1/3] commit: allow associating auxiliary info on-demand

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 14, 2013, 19:01 UTC
Message-ID
<7vfvyt543i.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130414151229.GA1544@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> Thanks, this writeup makes sense to me. Obviously,
>
>   Signed-off-by: Jeff King <peff@peff.net>
>
> Comparing a slab index versus a util pointer, I think the differences
> should be:
> ...
> So I think the util pointer is strictly better, except for point (2). And
> the main cost is point (1), the extra indirection. So if we can measure
> (1) and decide it isn't a big cost, the maintainability improvement for
> (2) is probably worth it, and we can rip out the util pointer entirely,
> saving us some extra space in "struct commit".

I am glad you brought up "util". In an earlier round of the indgree thing, I think that it was discussed that casting the indegree to (void *) and storing it there was a possibility. Because sorting was so generic a thing everybody may want in their codepath, and some callers may already have something they want to keep in util, we ended up adding a separate field not to interfere with the callers' use of the util field.

In the simpler days, a single util used with careful coorination among various codepaths may have been manageable, but I tend to think it will become more and more cumbersome to extend the system correctly (the same can be said for the in-object flags). We should encourage the users of the util field to migrate to either slab or decorate in the longer term.

A criterion to choose between the two is probably the density. The slab mechanism is for annotations that almost everybody involved in the processing gets, while decorate is more suited for sparse ones.

Previous: Jeff KingNext: Junio C Hamano
Message 4 of 12 in “Using commit slab to replace indegree”
  1. 0/3 Using commit slab to replace indegreeJunio C Hamano, Apr 14, 2013
  2. 1/3 commit: allow associating auxiliary info on-demandJunio C Hamano, Apr 14, 2013
  3. Jeff KingApr 14, 2013
  4. Junio C HamanoApr 14, 2013
  5. 2/3 commit-slab: avoid large reallocJunio C Hamano, Apr 14, 2013
  6. Jeff KingApr 14, 2013
  7. Junio C HamanoApr 14, 2013
  8. Jeff KingApr 14, 2013
  9. Junio C HamanoApr 15, 2013
  10. 3/3 commit-slab: introduce a macro to define a slab for new typeJunio C Hamano, Apr 14, 2013
  11. Jeff KingApr 14, 2013
  12. Junio C HamanoApr 15, 2013

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.