tools: Parallelize ./tools/format

10x speed improvement on my 3990x machine

Change-Id: Ie4b2377719e9a25860ec05bb7649aa652d26ccf0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113022
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-12-06 18:29:08 +00:00
committed by Dawn LUCI CQ
parent d933470b20
commit f2b8d2b1ab
3 changed files with 36 additions and 11 deletions

View File

@@ -75,6 +75,7 @@ func run() error {
taskIndices := make(chan int, 64)
type result struct {
cmd string
msg string
failed bool
}
@@ -93,7 +94,7 @@ func run() error {
}
success, out := invoke(exe, taskArgs)
if !success || !*onlyPrintFailures {
results[idx] = result{out, !success}
results[idx] = result{fmt.Sprint(append([]string{exe}, taskArgs...)), out, !success}
}
}
}()
@@ -109,7 +110,7 @@ func run() error {
failed := false
for _, result := range results {
if result.msg != "" {
fmt.Println(result.msg)
fmt.Printf("'%v' returned %v\n", result.cmd, result.msg)
}
failed = failed || result.failed
}