> I suspect in the future we may want to parallelize other commands for > submodules in which case a more general name such as submodules.threads > might be a better choice. The speed up in the cover letter is > impressive, could this be safely enabled by default? Unfortunately not. To reiterate the answer I gave to Avar: In my cover letter, I noted that with too many processes, status starts to slow down (but is still better than the baseline). This is because the expensive part of status is IO, specifically reading objects from the index. Much of the speedup of this patch comes from taking advantage of the ability to do parallel reads on an SSD, rather than splitting up the work of status. However, this doesn't work with an HDD, so status may actually be slower than baseline with multiple processes since there is now scheduling/switching overhead. > > > index fcf9c85947..c5147a7952 100644 > > --- a/builtin/commit.c > > +++ b/builtin/commit.c > > @@ -1468,6 +1468,12 @@ static int git_status_config(const char *k, const char *v, void *cb) > > s->detect_rename = git_config_rename(k, v); > > return 0; > > } > > + if (!strcmp(k, "status.parallelsubmodules")) { > > + s->parallel_jobs_submodules = git_config_int(k, v); > > + if (s->parallel_jobs_submodules < 0) > > + die(_("status.parallelsubmodules cannot be negative")); > > What does a value of zero mean? Looking at my code I set it to 1 if it's zero, but I should update the logic to something more reasonable as Junio suggested. > > > diff --git a/diff-lib.c b/diff-lib.c > > index 2e148b79e6..ec745755fc 100644 > > --- a/diff-lib.c > > +++ b/diff-lib.c > > > -int run_diff_files(struct rev_info *revs, unsigned int option) > > +int run_diff_files(struct rev_info *revs, unsigned int option, int parallel_jobs) > > Another possibility would be to add a member to struct diff_opts, rather > than changing the function signature here, I'm wondering what the trade > offs of the two approaches are. Also seeing all the callers from other > commands being changed made me wonder if they would benefit from > parallelizing submodules as well. There aren't any tests - could we use > GIT_TRACE2 to check that we are running the submodule diffs in parallel? Adding the option to rev_info seems like the best way forward. I neglected to write tests for this patch since the parallelism comes from run_processes_parallel() which already has tests for that. But maybe it is a good idea to also add a test with GIT_TRACE2 for a sanity check. Thanks!