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

Re: [PATCH] gc: remove redundant check for gc_auto_threshold

From
Brandon Casey <drafnel@gmail.com>
Date
Oct 10, 2018, 23:53 UTC
Message-ID
<CA+sFfMcrCZCJwzVDdyDFg8tb1g1N+2p8i556C-AhGSuHMJqLmw@mail.gmail.com>
In-Reply-To
<xmqqk1mpjru2.fsf@gitster-ct.c.googlers.com>
On Wed, Oct 10, 2018 at 4:38 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
>
> Brandon Casey <drafnel@gmail.com> writes:
>
> > ...  Again, I don't feel strongly about it, but I'm not
> > sure this change actually improves the code.
>
> Yeah, in the context of the current caller, this is a safe change
> that does not break anybody and reduces the number of instructions
> executed in this codepath.  A mistaken caller may be added in the
> future that fails to check auto-threashold beforehand, but that
> won't lead to anything bad like looping for a large number of times,
> so as long as the API contract into this helper function is clear
> that callers are responsible to check beforehand, it is still not
> too bad.
>
> So, I'd throw this into "Meh - I won't regret applying it, but it is
> not the end of the world if I forget to apply it, either" pile.
>
> I _think_ a change that actually improves the code would be to
> restructure so that there is a helper that is responsible for
> guestimating the number of loose objects, and another that uses the
> helper to see if there are too many loose objects.  The latter is
> the only one tha needs to know about auto-threashold.  But we are
> not in immdiate need for such a clean-up, I guess, unless somebody
> is actively looking into revamping how auto-gc works and doing a
> preparatory clean-up.
Agreed on all points, and as usual, said better than I could :-)
-Brandon
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 4 of 6 in “gc: remove redundant check for gc_auto_threshold”
  1. gc: remove redundant check for gc_auto_thresholdÆvar Arnfjörð Bjarmason, Oct 10, 2018
  2. Brandon CaseyOct 10, 2018
  3. Junio C HamanoOct 10, 2018
  4. Brandon CaseyOct 10, 2018
  5. Ævar Arnfjörð BjarmasonOct 11, 2018
  6. Junio C HamanoOct 13, 2018

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.