Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Commit 3bd3e6f

Browse files
committed
update docs
1 parent f4be5e0 commit 3bd3e6f

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

README.md

+36-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
11
# Benchmarks for Rust compiler performance
22

3-
Each subdirectory contains a single benchmark. Although benchmarks may contain
4-
multiple crates, each benchmark has one "crate of interest" which is the one
5-
whose compilation time is measured.
6-
7-
Each benchmark has a makefile with the following targets.
8-
* `all`: builds the entire benchmark. The following environment variables can
9-
be used to influence how it is built.
10-
* `CARGO_OPTS`: extra arguments to the `cargo` invocation.
11-
* `CARGO_RUSTC_OPTS`: extra arguments to `cargo rustc` invocations.
12-
* `touch`: touches or removes files in such a way that a subsequent `make`
13-
invocation will build only the crate of interest.
14-
* `clean`: removes all build artifacts.
15-
16-
A historical record of timings is shown at: http://perf.rust-lang.org/. This
17-
site makes use of the `process.sh` script plus some auxiliary scripts not in
18-
this repository.
3+
Each subdirectory contains a single benchmark. Although benchmarks may
4+
contain multiple crates, each benchmark has one "crate of interest"
5+
which is the one whose compilation time is measured. However, to test
6+
incremental, the full benchmark may involve building that same crate
7+
many times in succession, applying a different patch each time.
8+
9+
### How benchmarks work
10+
11+
Each benchmark contains a makefile. This makefile defines various
12+
standard targets. The basic procedure for running a benchmark is defined
13+
in `process.sh` and looks like this:
14+
15+
1. Invoke `make patches` to get a list of patches. This target should
16+
output a series of patches, or else output nothing. If it outputs nothing,
17+
that indicates that this is a non-incremental benchmark, and is treated
18+
as having a patches array with a single empty string `("")`. For incremental
19+
benchmarks, it would output a series of patch names like `@000-base` or
20+
`@010-foo`. By convention these begin with an `@` and a number that increments
21+
by 10 (000, 010, 020) --- this leaves room for inserting steps later. They
22+
then have a brief description.
23+
2. To run the benchmark, you then invoke `make all$PATCH` for each patch.
24+
So, for non-incremental tests, this is just `make all`. For incremental tests,
25+
it would be something like `make all@000-base`, followed by `make all@010-foo`, etc.
26+
- Each stage should run cargo to build the target crate. The basic
27+
invocation should be something like this, where `CARGO_OPTS` and
28+
`CARGO_RUSTC_OPTS` are variables set by `process.sh`:
29+
- `cargo rustc -p target_crate $CARGO_OPTS -- $CARGO_RUSTC_OPTS`
30+
- These `CARGO_RUSTC_OPTS` will include `-Z time-passes`, causing the compiler to
31+
emit timing information. This information is saved (by `process.sh`) into an intermediate
32+
file. It can later be scraped.
33+
3. After executing all the `make all@...` targets, `make touch` is used to reset the state
34+
to the initial state. We can then repeat step 2 as many times as desired.
35+
4. Finally, `make clean` is used to restore everything and remove any temporary data.
36+
37+
### Local runs
1938

2039
Local runs comparing two different compilers can be performed with
2140
`compare.py`. Invocation is simple:
41+
2242
> `./compare.py <rustc1> <rustc2>`
2343
2444
This is useful when evaluating compile-time optimizations.

scripts/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ Scripts for timing rustc.
44

55
See nrc/rustc-perf for visualisation.
66

7-
See nrc/benchmarks for more scripts and benchmarks.
8-
97
See nrc/rustc-timing for the collected data.

0 commit comments

Comments
 (0)