summaryrefslogtreecommitdiffstats
path: root/subcmds/branches.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-02-16 01:45:39 -0500
committerMike Frysinger <vapier@google.com>2021-02-22 22:51:34 +0000
commit7c871163c8803e812998e5b2296e3bbb30b1367f (patch)
treebbd137a70f4237e1c7837f3daeb9e0844326b051 /subcmds/branches.py
parent6a2400a4d097b6e510dc9b8ec06283517b9ca3ad (diff)
downloadgit-repo-7c871163c8803e812998e5b2296e3bbb30b1367f.tar.gz
status: improve parallel execution stability
The status command runs a bunch of jobs in parallel, and each one is responsible for writing to stdout directly. When running many noisy jobs in parallel, output can get intermingled. Pass down a StringIO buffer for writing to so we can return the entire output as a string so the main job can handle displaying it. This fixes interleaved output as well as making the output stable: we always display results in the same project order now. By switching from map to imap, this ends up not really adding any overhead. Bug: https://crbug.com/gerrit/12231 Change-Id: Ic18b07c8074c046ff36e306eb8d392fb34fb6eca Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297242 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
Diffstat (limited to 'subcmds/branches.py')
-rw-r--r--subcmds/branches.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/subcmds/branches.py b/subcmds/branches.py
index 9665e85f..d5ea580c 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -16,15 +16,7 @@ import itertools
16import multiprocessing 16import multiprocessing
17import sys 17import sys
18from color import Coloring 18from color import Coloring
19from command import Command, DEFAULT_LOCAL_JOBS 19from command import Command, DEFAULT_LOCAL_JOBS, WORKER_BATCH_SIZE
20
21# Number of projects to submit to a single worker process at a time.
22# This number represents a tradeoff between the overhead of IPC and finer
23# grained opportunity for parallelism. This particular value was chosen by
24# iterating through powers of two until the overall performance no longer
25# improved. The performance of this batch size is not a function of the
26# number of cores on the system.
27WORKER_BATCH_SIZE = 32
28 20
29 21
30class BranchColoring(Coloring): 22class BranchColoring(Coloring):