1
Fork 0

update README, remove buildifier

main
Motiejus Jakštys 2022-11-21 06:25:58 +02:00
parent 13e9363cd8
commit 2dc25f0e3e
3 changed files with 13 additions and 36 deletions

8
.envrc
View File

@ -4,15 +4,12 @@ BIN_DIR="$(git rev-parse --show-toplevel)/bin"
export PATH="$BIN_DIR:$PATH"
_u_bzl=https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-
_u_bldf=https://github.com/bazelbuild/buildtools/releases/download/5.1.0/buildifier-
if [[ "${PRINT_TOOL_HASHES:-no}" = "yes" ]]; then
for os in linux darwin; do
for arch in amd64 arm64; do
hash_bzl=$(direnv fetchurl "${_u_bzl}$os-$arch")
hash_bldf=$(direnv fetchurl "${_u_bldf}$os-$arch")
echo -e "bzl: $os-$arch\t$hash_bzl"
echo -e "bldf: $os-$arch\t$hash_bldf"
done
done
fi
@ -22,19 +19,15 @@ fi
case "$(uname | tr A-Z a-z)-$(uname -m)" in
linux-x86_64)
bzl=$(direnv fetchurl "${_u_bzl}linux-amd64" sha256-awvLLqFbyhb/+r5v2nWANEA3U1TAhUgP42HSy/MlAds=)
bldf=$(direnv fetchurl "${_u_bldf}linux-amd64" sha256-Ur9rECy0+IRk4ZfKrAbWl5P6KwX1rVCn579vvWVmSKM=)
;;
linux-aarch64)
bzl=$(direnv fetchurl "${_u_bzl}linux-arm64" sha256-KdhhykjfJKPo3sV/sAUIumZKMZIQR7JobDjPmiDUY58=)
bldf=$(direnv fetchurl "${_u_bldf}linux-arm64" sha256-kX1ZnbsEDmOuen4a23ENIFeBGQL9yeNczpJev9lm7rg=)
;;
darwin-x86_64)
bzl=$(direnv fetchurl "${_u_bzl}darwin-amd64" sha256-cM9/50gI0WQY03H+uMzU58RCFdsD0sT/x1t2e3ZUCfs=)
bldf=$(direnv fetchurl "${_u_bldf}darwin-amd64" sha256-yTeNn0KT/DjsVKCPvHTnqdKJFNrmiRM0QB5Z849uZdw=)
;;
darwin-arm64)
bzl=$(direnv fetchurl "${_u_bzl}darwin-arm64" sha256-NFu4uQDWue90I06enkE67Tj7Ke8lXkrhisYb9KYQLYQ=)
bldf=$(direnv fetchurl "${_u_bldf}darwin-arm64" sha256-dF/rXqlstv85p2soIcV1kf1wtSgyVWJIbUe10IkA4uQ=)
;;
*)
>&2 echo "unsupported architecture tuple $(uname | tr A-Z a-z)-$(uname -m)"
@ -42,4 +35,3 @@ case "$(uname | tr A-Z a-z)-$(uname -m)" in
esac
ln -sf "${bzl}" "$BIN_DIR/bazel"
ln -sf "${bldf}" "$BIN_DIR/buildifier"

2
BUILD
View File

@ -1,4 +1,4 @@
NTESTS=16
NTESTS=64
[
cc_binary(

View File

@ -7,43 +7,28 @@ reproduces that.
Steps to reproduce
------------------
llvm14: 10-11 seconds to compile 96 binaries on an 8-core machine:
llvm14: 12-13 seconds to compile 64 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
INFO: Analyzed 64 targets (41 packages loaded, 1426 targets configured).
INFO: Found 64 targets...
INFO: Elapsed time: 12.454s, Critical Path: 1.11s
INFO: 321 processes: 193 internal, 128 linux-sandbox.
INFO: Build completed successfully, 321 total actions
```
zig cc: 3.5 minutes. Anecdotally when looking at `htop` looks like it does not
parallelize at all:
zig cc: 2,5 minutes:
```
$ 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$
INFO: Analyzed 64 targets (41 packages loaded, 14450 targets configured).
INFO: Found 64 targets...
INFO: Elapsed time: 142.264s, Critical Path: 20.65s
INFO: 257 processes: 129 internal, 128 linux-sandbox.
INFO: Build completed successfully, 257 total actions
```