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

Re: [PATCH 3/5] pack-objects: clamp negative window size to 0

From
René Scharfe <l.s.r@web.de>
Date
May 5, 2021, 16:19 UTC
Message-ID
<aa21321a-08d8-5a3a-0ccd-4f4ea4bf7a9c@web.de>
In-Reply-To
<874kfhwfwz.fsf@evledraar.gmail.com>
Am 05.05.21 um 13:53 schrieb Ævar Arnfjörð Bjarmason:
Show 5 quoted lines
>
> On Tue, May 04 2021, René Scharfe wrote:
>
>> There's another option: Mapping -1 or all negative values to the
>> maximum:
> That seems sensible to expose, but I think should really be
> --window=max, not --window=-1. The latter feels way too much like
> assuming that a user might know about C's "set all bits" semantics.
Nitpicking: Setting all bits for -1 is done by two's complement, which
is just one of the signed number representations supported by C.

But yeah: A non-numeric value would probably be better in general. As Peff explained it's not a particularly good idea to specify the maximum values of --depth and --window, though, so no need to make it easier.

> The one example of such a variable I could think of is core.abbrev=no,
> which could arguably benefit from a core.abbrev=max synonym.

core.abbrev=no turns off abbreviation, i.e. you get the full hash size (false and off work as well).

Following that logic, core.abbrev=max would ask for a maximum of abbreviation, i.e. for the shortest unambiguous hash. That would have a length of at least 4. This value is stored in a constant called minimum_abbrev -- which seems backwards. The implied negation of abbrev (the more you abbreviate, the shorter the length) is a bit confusing.

Show 6 quoted lines
> Another one is *.threads, e.g. grep.threads, index.threads. We currently
> say that "auto" is like "max, but I can see how we'd eventually benefit
> from splitting those up. I sometimes run git on machines where that
> "auto" is 48 or whatever (I haven't benchmarked, but that's surely
> counter-productive). Having max != auto in that case (but still having a
> "max") would be nice.

Good thinking. What is the maximum number of threads? Certainly higher than the number of CPUs. Would that be useful? Maybe -- on a single-core VM with an SSD queue length of 32 we can probably benefit from running more than one thread.

Are our threads CPU-bound or I/O-bound? I guess the answer is "yes". :) How do we even find out the disk queue length in a portable way? And how would we calculate the optimal number of threads? Are these even the right questions to ask?

An "auto" option might help with that. I imagine it starting out with some default value and then experimentally decreasing and and increasing the number of threads to find out which one works best. Downside: It would need to have comparable workloads for that. And these benchmarks need an otherwise quiet system. Similar battery level if running on a laptop. Same system temperature. Impractical during normal use.

Perhaps a "git benchmark" command that runs some synthetic speed tests to tune grep.threads etc. would be possible?

René
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 12 of 15 in “pack-objects: better handling of negative options”
  1. 0/5 pack-objects: better handling of negative optionsJeff King, May 1, 2021
  2. 1/5 t5300: modernize basic testsJeff King, May 1, 2021
  3. Junio C HamanoMay 3, 2021
  4. Jeff KingMay 3, 2021
  5. 2/5 t5300: check that we produced expected number of deltasJeff King, May 1, 2021
  6. 3/5 pack-objects: clamp negative window size to 0Jeff King, May 1, 2021
  7. Derrick StoleeMay 3, 2021
  8. Jeff KingMay 3, 2021
  9. René ScharfeMay 4, 2021
  10. Jeff KingMay 4, 2021
  11. Ævar Arnfjörð BjarmasonMay 5, 2021
  12. René ScharfeMay 5, 2021
  13. 4/5 t5316: check behavior of pack-objects --depth=0Jeff King, May 1, 2021
  14. 5/5 pack-objects: clamp negative depth to 0Jeff King, May 1, 2021
  15. Derrick StoleeMay 3, 2021

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.