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

Re: [PATCH 4/3] untracked-cache: use FLEX_ALLOC to create internal structs

From
Jeff King <peff@peff.net>
Date
Apr 19, 2019, 19:43 UTC
Message-ID
<20190419194329.GA28277@sigill.intra.peff.net>
In-Reply-To
<CACsJy8BHwM5dUqa-FOjr3smxJT6kW4z7vLUJvsHuhjxwUjvkBw@mail.gmail.com>
On Fri, Apr 19, 2019 at 04:18:25PM +0700, Duy Nguyen wrote:
Show 11 quoted lines
> > I also wondered if we could just accept the cost of calloc() here and
> > use FLEX_ALLOC to simplify things. That resulted in the patch below, but
> > I didn't include it with the initial 3, because I think it's too
> > subtle/gross for my tastes.
> 
> It's probably ok. If I remember correctly, reading UNTR extension (on
> a huge repo) took the longest time after Ben added support for reading
> the index with multiple threads. So performance is a concern, but I
> don't think calloc() would be the problem. malloc() itself without the
> memory pool could probably slow down more when we have lots and lots
> of directories.

I think if we do the FLEX_ALLOC_COPY() thing I mentioned that it would probably _not_ use calloc() there, since we'd know we were copying in the content from elsewhere. So that concern would go away either way. :)

(But I'm still skeptical that FLEX_ALLOC_COPY() is worth it unless we can find at least one other caller).

-Peff
Previous: Duy Nguyen
Message 13 of 13 in “Fix an off-by-one bug in the untracked cache code”
  1. 0/1 Fix an off-by-one bug in the untracked cache codeJohannes Schindelin via GitGitGadget, Apr 10, 2019
  2. 1/1 untracked cache: fix off-by-oneJohannes Schindelin via GitGitGadget, Apr 10, 2019
  3. Jeff KingApr 10, 2019
  4. Junio C HamanoApr 12, 2019
  5. 0/3 untracked cache parsing fixupsJeff King, Apr 18, 2019
  6. 1/3 untracked-cache: be defensive about missing NULs in indexJeff King, Apr 18, 2019
  7. Junio C HamanoApr 19, 2019
  8. 2/3 untracked-cache: simplify parsing by dropping "next"Jeff King, Apr 18, 2019
  9. Junio C HamanoApr 19, 2019
  10. 3/3 untracked-cache: simplify parsing by dropping "len"Jeff King, Apr 18, 2019
  11. 4/3 untracked-cache: use FLEX_ALLOC to create internal structsJeff King, Apr 18, 2019
  12. Duy NguyenApr 19, 2019
  13. Jeff KingApr 19, 2019

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.