Skip to content

Commit a5a2d8e

Browse files
committed
Use a ridiculous number of workers for parallel checkout
It would appear that even on a 2-core build agent, using 64 workers leads to much faster checkout times than using a single worker, at least on the Windows agents, which is what we're interested in here. At some stage (somewhere between 64 and 92 workers in my tests), we risk using too many resources, though, and the checkout fails. _Very fast_, but it fails. So let's try to strike a balance between getting fast and still staying robust enough not to fail. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 144535a commit a5a2d8e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/git.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import {delimiter} from 'path'
55

66
const gitForWindowsUsrBinPath = 'C:/Program Files/Git/usr/bin'
77

8+
/*
9+
* It looks a bit ridiculous to use 56 workers on a build agent that has only
10+
* a two-core CPU, yet manual testing revealed that 64 workers would be _even
11+
* better_. But at 92 workers, resources are starved so much that the checkout
12+
* is not only much faster, but also fails.
13+
*
14+
* Let's stick with 56, which should avoid running out of resources, but still
15+
* is much faster than, say, using only 2 workers.
16+
*/
17+
const GIT_CONFIG_PARAMETERS = `'checkout.workers=56'`
18+
819
async function clone(
920
url: string,
1021
destination: string,
@@ -24,6 +35,9 @@ async function clone(
2435
destination
2536
],
2637
{
38+
env: {
39+
GIT_CONFIG_PARAMETERS
40+
},
2741
stdio: [undefined, 'inherit', 'inherit']
2842
}
2943
)
@@ -85,6 +99,9 @@ export async function getViaGit(
8599
'git.exe',
86100
[`--git-dir=.tmp`, 'worktree', 'add', outputDirectory, id],
87101
{
102+
env: {
103+
GIT_CONFIG_PARAMETERS
104+
},
88105
stdio: [undefined, 'inherit', 'inherit']
89106
}
90107
)
@@ -112,6 +129,7 @@ export async function getViaGit(
112129
],
113130
{
114131
env: {
132+
GIT_CONFIG_PARAMETERS,
115133
COMSPEC:
116134
process.env.COMSPEC ||
117135
`${process.env.WINDIR}\\system32\\cmd.exe`,

0 commit comments

Comments
 (0)