2022-10-19 11:35:55 +03:00
|
|
|
bazel-zig-cc and llvm
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
bazel-zig-cc has a performance issue when compiling many files. This repository
|
|
|
|
reproduces that.
|
|
|
|
|
|
|
|
Steps to reproduce
|
|
|
|
------------------
|
|
|
|
|
2022-11-21 06:25:58 +02:00
|
|
|
llvm14: 12-13 seconds to compile 64 binaries on an 8-core machine:
|
2022-10-19 11:35:55 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
$ bazel clean; bazel shutdown; bazel build --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux ...
|
2022-11-21 06:25:58 +02:00
|
|
|
INFO: Elapsed time: 12.454s, Critical Path: 1.11s
|
2022-10-19 11:35:55 +03:00
|
|
|
```
|
|
|
|
|
2022-11-21 06:37:34 +02:00
|
|
|
zig cc: 142 seconds:
|
2022-10-19 11:35:55 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
$ bazel clean; bazel shutdown; bazel build --platforms=@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.28 ...
|
2022-11-21 06:25:58 +02:00
|
|
|
INFO: Elapsed time: 142.264s, Critical Path: 20.65s
|
2022-11-21 06:37:34 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
zig cc with `--sandbox_base=/dev/shm`: 40 seconds:
|
|
|
|
|
|
|
|
```
|
|
|
|
bazel clean; bazel shutdown; bazel build --sandbox_base=/dev/shm --platforms=@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.28 ...
|
|
|
|
INFO: Elapsed time: 42.251s, Critical Path: 5.26s
|
|
|
|
```
|
|
|
|
|
|
|
|
zig cc without the sandbox (which means zig will treat its dependencies as the same file): 17 seconds:
|
|
|
|
|
|
|
|
```
|
|
|
|
bazel clean; bazel shutdown; bazel build --spawn_strategy=local --platforms=@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.28 ...
|
|
|
|
INFO: Elapsed time: 17.021s, Critical Path: 1.67s
|
2022-10-26 00:00:18 +03:00
|
|
|
```
|