1
Fork 0
testing of github.com/uber/hermetic_cc_toolchain
 
 
 
Go to file
Motiejus Jakštys 13e9363cd8 add forgotten main.cc 2022-11-21 06:19:32 +02:00
bin let it be so 2022-10-19 12:00:28 +03:00
.bazelrc let it be so 2022-10-19 12:00:28 +03:00
.envrc let it be so 2022-10-19 12:00:28 +03:00
.gitignore let it be so 2022-10-19 12:00:28 +03:00
BUILD NTESTS: reduce from 96 to 16 2022-10-19 16:13:45 +03:00
README.md More data. 2022-10-26 00:00:18 +03:00
WORKSPACE upgrade bazel-zig-cc and zig 2022-11-21 06:18:35 +02:00
main.cc add forgotten main.cc 2022-11-21 06:19:32 +02:00

README.md

bazel-zig-cc and llvm

bazel-zig-cc has a performance issue when compiling many files. This repository reproduces that.

Steps to reproduce

llvm14: 10-11 seconds to compile 96 binaries on an 8-core machine:

$ bazel clean; bazel shutdown; bazel build --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux ...
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
Starting local Bazel server and connecting to it...
INFO: Analyzed 96 targets (41 packages loaded, 1458 targets configured).
INFO: Found 96 targets...
INFO: Elapsed time: 10.725s, Critical Path: 0.66s
INFO: 481 processes: 289 internal, 192 linux-sandbox.
INFO: Build completed successfully, 481 total actions

zig cc: 3.5 minutes. Anecdotally when looking at htop looks like it does not parallelize at all:

$ bazel clean; bazel shutdown; bazel build  --platforms=@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.28 ...
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
Starting local Bazel server and connecting to it...
INFO: Analyzed 96 targets (41 packages loaded, 14394 targets configured).
INFO: Found 96 targets...
INFO: Elapsed time: 214.333s, Critical Path: 18.31s
INFO: 385 processes: 193 internal, 192 linux-sandbox.
INFO: Build completed successfully, 385 total actions

Move sandbox to /dev/shm and reuse the sandboxes: 3 minutes and a bit.

$ bazel clean; bazel shutdown; bazel build --sandbox_base=/dev/shm --experimental_reuse_sandbox_directories  --platforms=@zig_sdk//libc_aware/platform:linux_amd64_gnu.2.28 ...
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
Starting local Bazel server and connecting to it...
INFO: Analyzed 96 targets (41 packages loaded, 14394 targets configured).
INFO: Found 96 targets...
INFO: Elapsed time: 194.643s, Critical Path: 25.35s
INFO: 385 processes: 193 internal, 192 linux-sandbox.
INFO: Build completed successfully, 385 total actions
motiejus@motiejus-20NYS8QG0B:/code/test-zigcc$