Commit 61dad1f
authored
buildifier: improve Windows runner performance (#1404)
* buildifier: improve Windows runner performance
This change aims to improve the `buildidier`'s runner performance on
Windows where it can sometimes take minutes to complete.
It consists in replacing the slow COM `Scripting.FileSystemObject` with
a "native" PowerShell `Get-ChildItem -Recurse` for file discovery, and
batch `buildifier` invocations (100 files at a time) instead of invoking
once per file.
This improves performance on large codebases (like from about 2 minutes
to less than 3 seconds).
Notes:
- cross-process COM calls add latency, whereas `Get-ChildItem` is a
compiled "cmdlet".
- by default, `Get-ChildItem` doesn't recurse into symbolic links to
directories, which is consistent with the current implementation that
explicitly avoids entering `ReparsePoint`s,
- batching files passed to `buildifier` reduces process creation
overhead, with a limit to account for Windows command line length
limitations.
References:
- https://stackoverflow.com/questions/73893997/comments-in-a-long-line-powershell-code-in-a-batch-script
- https://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string
- https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=415531 parent 82ab633 commit 61dad1f
1 file changed
+10
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
| |||
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments