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

Re: [PATCH 2/2] refs/files: use heuristic to decide whether to repack with `--auto`

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 3, 2024, 09:23 UTC
Message-ID
<ZtbVbn5rxrmLFuNa@pks.im>
In-Reply-To
<CAOLa=ZRGvU4LvX9kjvF3dJCTvKR6CC1CwPTp515c3Wt5M8a5vA@mail.gmail.com>
On Tue, Sep 03, 2024 at 02:00:16AM -0700, karthik nayak wrote:
Show 15 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/refs/files-backend.c b/refs/files-backend.c
> > index 1cff65f6ae5..261e2b8570f 100644
> > --- a/refs/files-backend.c
> > +++ b/refs/files-backend.c
> > @@ -1311,6 +1311,78 @@ static int should_pack_ref(struct files_ref_store *refs,
> >  	return 0;
> >  }
> >
> > +static size_t fastlog2(size_t sz)
> 
> Nit: We already `reftable/stack_test.c:fastlog2` and `bisect.c:log2i`. I
> wonder if it would be nice to consolidate all of them. But I guess it's
> okay, since the reftable code anyways is isolated from the rest of the
> Git code.

Yeah, the version we have here is in fact an (almost exact) copy of the function in our reftable codebase. And as you note, we do not want to deduplicate these such that the reftable library is somewhat isolated from the rest of the codebase.

I also noticed `log2i()`, but honestly the only reason why I didn't reuse it is that I had no clue where to put it. There isn't any header that would be a good fit for it, and creating a new "math.h" header for a single function felt overblown to me. So I decided to just not bother. I'm happy to adjust though if somebody has a suggestion for where to put it.

Patrick
Previous: karthik nayakNext: Junio C Hamano
Message 5 of 16 in “refs/files: use heuristic to decide whether to repack with `--auto`”
  1. 0/2 refs/files: use heuristic to decide whether to repack with `--auto`Patrick Steinhardt, Sep 2, 2024
  2. 1/2 t0601: merge tests for auto-packing of refsPatrick Steinhardt, Sep 2, 2024
  3. 2/2 refs/files: use heuristic to decide whether to repack with `--auto`Patrick Steinhardt, Sep 2, 2024
  4. karthik nayakSep 3, 2024
  5. Patrick SteinhardtSep 3, 2024
  6. Junio C HamanoSep 3, 2024
  7. Patrick SteinhardtSep 4, 2024
  8. Junio C HamanoSep 4, 2024
  9. Patrick SteinhardtSep 4, 2024
  10. karthik nayakSep 5, 2024
  11. 0/3 refs/files: use heuristics to decide whether to repack with `--auto`Patrick Steinhardt, Sep 4, 2024
  12. 1/3 wrapper: introduce `log2u()`Patrick Steinhardt, Sep 4, 2024
  13. 2/3 t0601: merge tests for auto-packing of refsPatrick Steinhardt, Sep 4, 2024
  14. 3/3 refs/files: use heuristic to decide whether to repack with `--auto`Patrick Steinhardt, Sep 4, 2024
  15. Junio C HamanoSep 4, 2024
  16. Patrick SteinhardtSep 5, 2024

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.