Skip to content

Commit a2f56cd

Browse files
authored
Merge pull request #2156 from Kobzol/rustdoc-json-perf-check
Add `DocJson` profile for benchmarking JSON rustdoc output
2 parents 70fe651 + 2f75b4e commit a2f56cd

File tree

15 files changed

+62
-21
lines changed

15 files changed

+62
-21
lines changed

collector/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ The following options alter the behaviour of the `bench_local` subcommand.
146146
possible choices are one or more (comma-separated) of `Primary`, `Secondary`,
147147
`Stable`, and `All`. The default is `Primary,Secondary`.
148148
- `--profiles <PROFILES>`: the profiles to be benchmarked. The possible choices
149-
are one or more (comma-separated) of `Check`, `Debug`, `Doc`, `Opt`, and
150-
`All`. The default is `Check,Debug,Opt`.
149+
are one or more (comma-separated) of `Check`, `Debug`, `Doc`, `DocJson`, `Opt`,
150+
`Clippy` and `All`. The default is `Check,Debug,Opt`.
151151
- `--rustdoc <RUSTDOC>`: a path (relative or absolute) to a rustdoc
152-
executable that will be benchmarked (but only if a `Doc` profile is requested
153-
with `--profiles`). If a `Doc` profile is requested, by default the tool will
152+
executable that will be benchmarked (but only if a `Doc`/`DocJson` profile is requested
153+
with `--profiles`). If a `Doc`/`DocJson` profile is requested, by default the tool will
154154
look for a rustdoc executable next to the rustc specified via the `<RUSTC>`
155155
argument.
156156
- `--scenarios <SCENARIOS>`: the scenarios to be benchmarked. The possible

collector/compile-benchmarks/bitmaps-3.2.1-new-solver/perf-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"category": "secondary",
44
"cargo_rustc_opts": "-Znext-solver=globally",
55
"excluded_profiles": [
6-
"Doc"
6+
"Doc",
7+
"DocJson"
78
],
89
"excluded_scenarios": [
910
"IncrFull",

collector/compile-benchmarks/html5ever-0.31.0-new-solver/perf-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"category": "secondary",
55
"cargo_rustc_opts": "-Znext-solver=globally",
66
"excluded_profiles": [
7-
"Doc"
7+
"Doc",
8+
"DocJson"
89
],
910
"excluded_scenarios": [
1011
"IncrFull",

collector/compile-benchmarks/nalgebra-0.33.0-new-solver/perf-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"category": "secondary",
44
"cargo_rustc_opts": "-Znext-solver=globally",
55
"excluded_profiles": [
6-
"Doc"
6+
"Doc",
7+
"DocJson"
78
],
89
"excluded_scenarios": [
910
"IncrFull",

collector/compile-benchmarks/serde-1.0.219-new-solver/perf-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"category": "secondary",
44
"cargo_rustc_opts": "-Znext-solver=globally",
55
"excluded_profiles": [
6-
"Doc"
6+
"Doc",
7+
"DocJson"
78
],
89
"excluded_scenarios": [
910
"IncrFull",

collector/compile-benchmarks/syn-2.0.101-new-solver/perf-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"category": "secondary",
44
"cargo_rustc_opts": "-Znext-solver=globally",
55
"excluded_profiles": [
6-
"Doc"
6+
"Doc",
7+
"DocJson"
78
],
89
"excluded_scenarios": [
910
"IncrFull",

collector/src/bin/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fn generate_diffs(
151151
for benchmark in benchmarks {
152152
for &profile in profiles {
153153
for scenario in scenarios.iter().flat_map(|scenario| {
154-
if profile == Profile::Doc && scenario.is_incr() {
154+
if profile.is_doc() && scenario.is_incr() {
155155
return vec![];
156156
}
157157
match scenario {

collector/src/compile/benchmark/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl Benchmark {
400400
}
401401

402402
// Rustdoc does not support incremental compilation
403-
if profile != Profile::Doc {
403+
if !profile.is_doc() {
404404
// An incremental from scratch (slowest incremental case).
405405
// This is required for any subsequent incremental builds.
406406
if scenarios.iter().any(|s| s.is_incr()) {

collector/src/compile/benchmark/profile.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, clap::ValueEnum, serde::Deserialize)]
99
#[value(rename_all = "PascalCase")]
1010
pub enum Profile {
11+
/// Perform the equivalent of `cargo check`.
1112
Check,
13+
/// Perform the equivalent of `cargo build`.
1214
Debug,
15+
/// Perform the equivalent of `cargo doc`.
1316
Doc,
17+
/// Perform the equivalent of `cargo doc` with `--output-format=json`.
18+
DocJson,
19+
/// Perform the equivalent of `cargo build --release`.
1420
Opt,
21+
/// Perform the equivalent of `cargo clippy`.
1522
Clippy,
1623
}
1724

@@ -21,8 +28,16 @@ impl Profile {
2128
Profile::Check,
2229
Profile::Debug,
2330
Profile::Doc,
31+
Profile::DocJson,
2432
Profile::Opt,
2533
Profile::Clippy,
2634
]
2735
}
36+
37+
pub fn is_doc(&self) -> bool {
38+
match self {
39+
Profile::Doc | Profile::DocJson => true,
40+
Profile::Check | Profile::Debug | Profile::Opt | Profile::Clippy => false,
41+
}
42+
}
2843
}

collector/src/compile/execute/bencher.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ impl Processor for BenchProcessor<'_> {
184184
Profile::Check => database::Profile::Check,
185185
Profile::Debug => database::Profile::Debug,
186186
Profile::Doc => database::Profile::Doc,
187+
Profile::DocJson => database::Profile::DocJson,
187188
Profile::Opt => database::Profile::Opt,
188189
Profile::Clippy => database::Profile::Clippy,
189190
};

0 commit comments

Comments
 (0)