浏览代码

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
Kurt Kartaltepe 5 年之前
父节点
当前提交
a7ebf47834
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      formatcode.sh

+ 1 - 1
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