Commit ee2537a
authored
Perform update in parallel (#110)
The update command implementation runs over files that are independent
from each other. As such, the overall update operation can be trivially
parallelised to speed things up.
This change introduces The list of files that need to be
compared/updated is collected in a first past. This list is then given
to a multiprocessing pool to farm out the actual update of each
individual file. The amount of parallelism is controlled through a new
"jobs" parameter, command line option and environment variable. If no
value is given for this option, all CPUs are used.
I noticed this chance for improvement when doing a test run of the
update of .po files for the Spanish translation of the CPython
documentation. Local numbers in my 8-core, hyper-threaded AMD Ryzen 7
5825U:
-j 1 (same as old behaviour)
real 12m5.402s
user 12m4.942s
sys 0m0.273s
-j 8
real 2m23.609s
user 17m45.201s
sys 0m0.460s
<no value given>
real 1m57.398s
user 26m22.654s
sys 0m0.989s
Signed-off-by: Rodrigo Tobar <[email protected]>1 parent 390a46b commit ee2537a
2 files changed
+90
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
28 | 80 | | |
29 | 81 | | |
30 | 82 | | |
| |||
33 | 85 | | |
34 | 86 | | |
35 | 87 | | |
| 88 | + | |
36 | 89 | | |
37 | 90 | | |
38 | 91 | | |
| |||
42 | 95 | | |
43 | 96 | | |
44 | 97 | | |
| 98 | + | |
45 | 99 | | |
46 | 100 | | |
47 | 101 | | |
| |||
52 | 106 | | |
53 | 107 | | |
54 | 108 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
89 | 124 | | |
90 | 125 | | |
91 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| |||
271 | 283 | | |
272 | 284 | | |
273 | 285 | | |
274 | | - | |
| 286 | + | |
| 287 | + | |
275 | 288 | | |
276 | 289 | | |
277 | 290 | | |
| |||
300 | 313 | | |
301 | 314 | | |
302 | 315 | | |
303 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
304 | 322 | | |
305 | 323 | | |
306 | 324 | | |
| |||
0 commit comments