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

Re: first bisection step takes quite a while

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 22, 2025, 02:15 UTC
Message-ID
<xmqqldty912l.fsf@gitster.g>
In-Reply-To
<CAP8UFD0xsZWDnH9kLJ4eWfzq4nvAm+qMHcdbZSf0d4-yPG9+5g@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 23 quoted lines
> On Fri, Feb 21, 2025 at 9:24 PM Christian Couder
> <christian.couder@gmail.com> wrote:
>>
>> On Fri, Feb 21, 2025 at 6:47 PM Junio C Hamano <gitster@pobox.com> wrote:
>
>> > >>  * The "this is good enough" logic currently allows us to be within
>> > >>    0.1% of the real halfway point.  Until the candidate set becomes
>> > >>    small enough, we could loosen the criteria to allow larger, say
>> > >>    3%, slack.  This code is written but not enabled (with "0 &&").
>> >
>> > The above follows the same reasoning why we chose "division by 1024"
>> > in the first place.  The illustration patch postulates that we could
>> > be way more aggressive than 0.1% while the set is large by dividing
>> > 64, without wanting to loosen the criteria near the end of the
>> > bisection session when the remaining set is reasonably small like
>> > 1000 commits.  So we cannot rely on integer division truncating.
>>
>> The code you posted above uses 10000 as the threshold, not 1000:
>>
>> 10000 < nr && abs(diff) < nr / 64) || abs(diff) < nr / 1024)
>
> Also if "division by 1024" means within 0.1% of the real halfway
> point, then division by 64 means 0.1 * 1024 / 64 = 1.6 % not 3%.

Heh, I suck at arithmetic (but that is why I have you guys around for correction ;-).

The current code makes sure that we do not punt with an inexact result below nr for which nr/1024 is truncated away. The overly loose cutoff that uses nr/64 needs to stop kicking in way before that happens to make sure we do not affect correctness with the change to optimize, and that is the only reason why 10000 was arbitrary chosen. The threashold could have been set at 5000, or 100000.

Exact numbers do not matter as much as the real issue, i.e., limiting the possible damage to correctness from the change near the end of a bisect session.

Thanks.
Previous: Christian CouderNext: D. Ben Knoble
Message 9 of 12 in “first bisection step takes quite a while”
  1. Uwe Kleine-KönigFeb 20, 2025
  2. D. Ben KnobleFeb 20, 2025
  3. Junio C HamanoFeb 20, 2025
  4. Junio C HamanoFeb 21, 2025
  5. Christian CouderFeb 21, 2025
  6. Junio C HamanoFeb 21, 2025
  7. Christian CouderFeb 21, 2025
  8. Christian CouderFeb 21, 2025
  9. Junio C HamanoFeb 22, 2025
  10. D. Ben KnobleFeb 24, 2025
  11. Uwe Kleine-KönigFeb 21, 2025
  12. Junio C HamanoFeb 21, 2025

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.