From a7ebf47834cf6e82c977aab05042c4257ec278ee Mon Sep 17 00:00:00 2001 From: Kurt Kartaltepe Date: Sun, 24 May 2020 13:55:49 -0700 Subject: [PATCH] CI: Improve formatcode.sh efficiency Batch files into clang-format to prevent needless processes. Now its twice as fast in real time and uses 4x less resources. The old implementation is also slower (but pretty close to) running a single invocation of clang-format on all files. before time ./formatcode.sh real 0m3.860s user 0m20.975s sys 0m6.694s after time ./formatcode.sh real 0m1.486s user 0m5.426s sys 0m0.203s --- formatcode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formatcode.sh b/formatcode.sh index f585bc2b3..9a0c1338b 100755 --- a/formatcode.sh +++ b/formatcode.sh @@ -35,4 +35,4 @@ find . -type d \( -path ./deps \ -o -path ./plugins/obs-outputs/ftl-sdk \ -o -path ./plugins/obs-vst \ -o -path ./build \) -prune -type f -o -name '*.h' -or -name '*.hpp' -or -name '*.m' -or -name '*.mm' -or -name '*.c' -or -name '*.cpp' \ -| xargs -I{} -P ${NPROC} ${CLANG_FORMAT} -i -style=file -fallback-style=none {} +| xargs -L100 -P${NPROC} ${CLANG_FORMAT} -i -style=file -fallback-style=none