C++ Benchmarks for the Bazel build system
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.dockerignore
.gitignore
Dockerfile.builder
Dockerfile.cacher
README.md
benchmarks.py
docker-compose.yml
nginx.conf
plot_results.py
requirements.txt

README.md

Bazel build benchmarks

Bazel is Google's open source build system. This repo is a companion to my blog post and contains the configuration and scripts that I used for benchmarks.

The cacher _docker composeservice is a simple instance of nginx + WebDAV to serve as a remote cache. Thebuilder` does the actual C++ builds with Bazel and clang 3.9.

Set-up

You'll need docker and docker-compose installed. Then:

docker-compose build && docker-compose up

will build the images and start the cache server. Then, get a builder shell:

docker-compose run builder bash

Interactive demo

git clone $BENCHMARK_GIT_REPO_URL $BENCHMARK_GIT_REPO_PATH
./benchmarks.py configure_bazel --cache

cd $BENCHMARK_GIT_REPO_PATH
cloc .

# Let's build some code now
git checkout $BENCHMARK_GIT_REV_OLD

# The cache is empty
rm -rf /src/cacher_root/*

bazel build //drake/examples:simple_continuous_time_system
# This took x seconds
# A no-op build is very fast:
bazel build //drake/examples:simple_continuous_time_system

# We filled up the cache:
du -sh /src/cacher_root

# Let's checkout a different revision
git checkout $BENCHMARK_GIT_REV_NEW
# There's quite a difference between the two
git diff $BENCHMARK_GIT_REV_OLD $BENCHMARK_GIT_REV_NEW | wc -l

# Build this new revision
bazel build //drake/examples:simple_continuous_time_system

# Let's check the cache again
du -sh /src/cacher_root

# Go back to the first
git checkout $BENCHMARK_GIT_REV_OLD

# Build again
bazel build //drake/examples:simple_continuous_time_system

# Let's spin up a new instance and make sure it can use the cache
exit

docker-compose run builder bash

git clone $BENCHMARK_GIT_REPO_URL $BENCHMARK_GIT_REPO_PATH
./benchmarks.py configure_bazel --cache

git checkout $BENCHMARK_GIT_REV_OLD

# The cache is still there:
du -sh /src/cacher_root

bazel build //drake/examples:simple_continuous_time_system