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

Re: [PATCH v2 0/4] submodule: parallelize diff

From
Calvin Wan <calvinwan@google.com>
Date
Oct 14, 2022, 00:39 UTC
Message-ID
<CAFySSZAi_XtwAQeVDgbjXD7vnGuYgNLNo+6NNJP0QvH64KxPOA@mail.gmail.com>
In-Reply-To
<xmqqczaxmvv9.fsf@gitster.g>
Show 18 quoted lines
> Calvin Wan <calvinwan@google.com> writes:
>
> > I also wanted to pose another question to list regarding defaults for
> > parallel processes. For jobs that clearly scale with the number of
> > processes (aka jobs that are mostly processor bound), it is obvious that
> > setting the default number of processes to the number of available cores
> > is the most optimal option. However, this changes when the job is mostly
> > I/O bound or has a combination of I/O and processing. Looking at my use
> > case for `status` on a cold cache (see below), we notice that increasing
> > the number of parallel processes speeds up status, but after a certain
> > number, it actually starts slowing down.
>
> I do not offhand recall how the default parallelism is computed
> there, but if I am correct to suspect that "git grep" has a similar
> scaling pattern, i.e. the threads all need to compete for I/O to
> read from the filesystem to find needles from the haystack, perhaps
> it would give us a precedent to model the behaviour of this part of
> the code, too, hopefully?

Setting grep.threads=0 does default it to the number of available cores (at least the documentation is clear about this). I tested "git grep" on my machine and found that it started slowing down after 4 threads -- this is most likely because my NVMe SSD uses 4 PCIe lanes aka it can at most do 4 reads in parallel. AFAIK, there is no way to tell how many reads a disk can do in parallel. This coupled with the fact that other commands have varying levels of IO requirements makes it impossible to set a "reasonable" amount of threads.

Previous: Junio C HamanoNext: Calvin Wan
Message 3 of 11 in “submodule: parallelize diff”
  1. 0/4 submodule: parallelize diffCalvin Wan, Oct 11, 2022
  2. Junio C HamanoOct 12, 2022
  3. Calvin WanOct 14, 2022
  4. 1/4 run-command: add pipe_output_fn to run_processes_parallel_optsCalvin Wan, Oct 11, 2022
  5. Ævar Arnfjörð BjarmasonOct 12, 2022
  6. 2/4 submodule: move status parsing into functionCalvin Wan, Oct 11, 2022
  7. Ævar Arnfjörð BjarmasonOct 12, 2022
  8. Ævar Arnfjörð BjarmasonOct 12, 2022
  9. 3/4 diff-lib: refactor match_stat_with_submoduleCalvin Wan, Oct 11, 2022
  10. 4/4 diff-lib: parallelize run_diff_files for submodulesCalvin Wan, Oct 11, 2022
  11. Ævar Arnfjörð BjarmasonOct 12, 2022

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.