You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [Rust benchmark suite][rustc-perf] provides a comprehensive way of profiling and benchmarking
4
+
the Rust compiler. You can find instructions on how to use the suite in its [manual][rustc-perf-readme].
5
+
6
+
However, using the suite manually can be a bit cumbersome. To make this easier for `rustc` contributors,
7
+
the compiler build system (`bootstrap`) also provides built-in integration with the benchmarking suite,
8
+
which will download and build the suite for you, build a local compiler toolchain and let you profile it using a simplified command-line interface.
9
+
10
+
You can use the `./x perf -- <command> [options]` command to use this integration.
11
+
12
+
> Note that you need to specify arguments after `--` in the `x perf` command! You will not be able to pass arguments without the double dashes.
13
+
14
+
You can use normal bootstrap flags for this command, such as `--stage 1` or `--stage 2`, for example to modify the stage of the created sysroot. It might also be useful to configure `config.toml` to better support profiling, e.g. set `rust.debuginfo-level = 1` to add source line information to the built compiler.
15
+
16
+
`x perf` currently supports the following commands:
17
+
-`benchmark <id>`: Benchmark the compiler and store the results under the passed `id`.
18
+
-`compare <baseline> <modified>`: Compare the benchmark results of two compilers with the two passed `id`s.
19
+
-`eprintln`: Just run the compiler and capture its `stderr` output. Note that the compiler normally does not print
20
+
anything to `stderr`, you might want to add some `eprintln!` calls to get any output.
21
+
-`samply`: Profile the compiler using the [samply][samply] sampling profiler.
22
+
-`cachegrind`: Use [Cachegrind][cachegrind] to generate a detailed simulated trace of the compiler's execution.
23
+
24
+
> You can find a more detailed description of the profilers in the [`rustc-perf` manual][rustc-perf-readme-profilers].
25
+
26
+
You can use the following options for the `x perf` command, which mirror the corresponding options of the
27
+
`profile_local` and `bench_local` commands that you can use in the suite:
28
+
29
+
-`--include`: Select benchmarks which should be profiled/benchmarked.
30
+
-`--profiles`: Select profiles (`Check`, `Debug`, `Opt`, `Doc`) which should be profiled/benchmarked.
31
+
-`--scenarios`: Select scenarios (`Full`, `IncrFull`, `IncrPatched`, `IncrUnchanged`) which should be profiled/benchmarked.
0 commit comments