Skip to content

Commit 63867dd

Browse files
committed
Auto merge of rust-lang#15552 - Veykril:metrics-new, r=Veykril
Bump `rustc-perf` checkout for metrics, replace webrender, diesel and ripgrep with newer versions The previous versions were removed hence the updates. The metric results for the changed ones are disconnected now as to not muddle things up. I think it's worth it for us to occasionally bump the `rustc-perf` checkout, as it allows us to include more interesting new targets. Notably, the newer diesel is 3 times as fast to analyze as the one of the current checkout.
2 parents 99686d5 + f76f025 commit 63867dd

File tree

3 files changed

+52
-46
lines changed

3 files changed

+52
-46
lines changed

.github/workflows/metrics.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
other_metrics:
6868
strategy:
6969
matrix:
70-
names: [self, ripgrep, webrender, diesel]
70+
names: [self, ripgrep-13.0.0, webrender-2022, diesel-1.4.8]
7171
runs-on: ubuntu-latest
7272
needs: [setup_cargo, build_metrics]
7373

@@ -92,7 +92,7 @@ jobs:
9292
key: ${{ runner.os }}-target-${{ github.sha }}
9393

9494
- name: Collect metrics
95-
run: cargo xtask metrics ${{ matrix.names }}
95+
run: cargo xtask metrics "${{ matrix.names }}"
9696

9797
- name: Upload metrics
9898
uses: actions/upload-artifact@v3
@@ -118,25 +118,25 @@ jobs:
118118
with:
119119
name: self-${{ github.sha }}
120120

121-
- name: Download ripgrep metrics
121+
- name: Download ripgrep-13.0.0 metrics
122122
uses: actions/download-artifact@v3
123123
with:
124-
name: ripgrep-${{ github.sha }}
124+
name: ripgrep-13.0.0-${{ github.sha }}
125125

126-
- name: Download webrender metrics
126+
- name: Download webrender-2022 metrics
127127
uses: actions/download-artifact@v3
128128
with:
129-
name: webrender-${{ github.sha }}
129+
name: webrender-2022-${{ github.sha }}
130130

131-
- name: Download diesel metrics
131+
- name: Download diesel-1.4.8 metrics
132132
uses: actions/download-artifact@v3
133133
with:
134-
name: diesel-${{ github.sha }}
134+
name: diesel-1.4.8-${{ github.sha }}
135135

136136
- name: Combine json
137137
run: |
138138
git clone --depth 1 https://$METRICS_TOKEN@github.com/rust-analyzer/metrics.git
139-
jq -s ".[0] * .[1] * .[2] * .[3] * .[4]" build.json self.json ripgrep.json webrender.json diesel.json -c >> metrics/metrics.json
139+
jq -s ".[0] * .[1] * .[2] * .[3] * .[4]" build.json self.json ripgrep-13.0.0.json webrender-2022.json diesel-1.4.8.json -c >> metrics/metrics.json
140140
cd metrics
141141
git add .
142142
git -c user.name=Bot -c user.email=dummy@example.com commit --message 📈

xtask/src/flags.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,24 @@ impl FromStr for MeasurementType {
122122
match s {
123123
"build" => Ok(Self::Build),
124124
"self" => Ok(Self::AnalyzeSelf),
125-
"ripgrep" => Ok(Self::AnalyzeRipgrep),
126-
"webrender" => Ok(Self::AnalyzeWebRender),
127-
"diesel" => Ok(Self::AnalyzeDiesel),
125+
"ripgrep-13.0.0" => Ok(Self::AnalyzeRipgrep),
126+
"webrender-2022" => Ok(Self::AnalyzeWebRender),
127+
"diesel-1.4.8" => Ok(Self::AnalyzeDiesel),
128128
_ => Err("Invalid option".to_string()),
129129
}
130130
}
131131
}
132+
impl AsRef<str> for MeasurementType {
133+
fn as_ref(&self) -> &str {
134+
match self {
135+
Self::Build => "build",
136+
Self::AnalyzeSelf => "self",
137+
Self::AnalyzeRipgrep => "ripgrep-13.0.0",
138+
Self::AnalyzeWebRender => "webrender-2022",
139+
Self::AnalyzeDiesel => "diesel-1.4.8",
140+
}
141+
}
142+
}
132143

133144
#[derive(Debug)]
134145
pub struct Metrics {

xtask/src/metrics.rs

+29-34
Original file line numberDiff line numberDiff line change
@@ -29,46 +29,40 @@ impl flags::Metrics {
2929

3030
let _env = sh.push_env("RA_METRICS", "1");
3131

32-
let filename = match self.measurement_type {
33-
Some(ms) => match ms {
34-
MeasurementType::Build => {
35-
metrics.measure_build(sh)?;
36-
"build.json"
37-
}
38-
MeasurementType::AnalyzeSelf => {
39-
metrics.measure_analysis_stats_self(sh)?;
40-
"self.json"
41-
}
42-
MeasurementType::AnalyzeRipgrep => {
43-
metrics.measure_analysis_stats(sh, "ripgrep")?;
44-
"ripgrep.json"
45-
}
46-
MeasurementType::AnalyzeWebRender => {
47-
{
48-
// https://github.com/rust-lang/rust-analyzer/issues/9997
49-
let _d = sh.push_dir("target/rustc-perf/collector/benchmarks/webrender");
50-
cmd!(sh, "cargo update -p url --precise 1.6.1").run()?;
32+
let name = match &self.measurement_type {
33+
Some(ms) => {
34+
let name = ms.as_ref();
35+
match ms {
36+
MeasurementType::Build => {
37+
metrics.measure_build(sh)?;
5138
}
52-
metrics.measure_analysis_stats(sh, "webrender")?;
53-
"webrender.json"
54-
}
55-
MeasurementType::AnalyzeDiesel => {
56-
metrics.measure_analysis_stats(sh, "diesel/diesel")?;
57-
"diesel.json"
58-
}
59-
},
39+
MeasurementType::AnalyzeSelf => {
40+
metrics.measure_analysis_stats_self(sh)?;
41+
}
42+
MeasurementType::AnalyzeRipgrep => {
43+
metrics.measure_analysis_stats(sh, name)?;
44+
}
45+
MeasurementType::AnalyzeWebRender => {
46+
metrics.measure_analysis_stats(sh, name)?;
47+
}
48+
MeasurementType::AnalyzeDiesel => {
49+
metrics.measure_analysis_stats(sh, name)?;
50+
}
51+
};
52+
name
53+
}
6054
None => {
6155
metrics.measure_build(sh)?;
6256
metrics.measure_analysis_stats_self(sh)?;
63-
metrics.measure_analysis_stats(sh, "ripgrep")?;
64-
metrics.measure_analysis_stats(sh, "webrender")?;
65-
metrics.measure_analysis_stats(sh, "diesel/diesel")?;
66-
"all.json"
57+
metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeRipgrep.as_ref())?;
58+
metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeWebRender.as_ref())?;
59+
metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeDiesel.as_ref())?;
60+
"all"
6761
}
6862
};
6963

7064
let mut file =
71-
fs::File::options().write(true).create(true).open(format!("target/{}", filename))?;
65+
fs::File::options().write(true).create(true).open(format!("target/{}.json", name))?;
7266
writeln!(file, "{}", metrics.json())?;
7367
eprintln!("{metrics:#?}");
7468
Ok(())
@@ -93,7 +87,7 @@ impl Metrics {
9387
self.measure_analysis_stats_path(
9488
sh,
9589
bench,
96-
&format!("./target/rustc-perf/collector/benchmarks/{bench}"),
90+
&format!("./target/rustc-perf/collector/compile-benchmarks/{bench}"),
9791
)
9892
}
9993
fn measure_analysis_stats_path(
@@ -102,6 +96,7 @@ impl Metrics {
10296
name: &str,
10397
path: &str,
10498
) -> anyhow::Result<()> {
99+
assert!(Path::new(path).exists(), "unable to find bench in {path}");
105100
eprintln!("\nMeasuring analysis-stats/{name}");
106101
let output = cmd!(sh, "./target/release/rust-analyzer -q analysis-stats {path}").read()?;
107102
for (metric, value, unit) in parse_metrics(&output) {
@@ -145,7 +140,7 @@ impl Metrics {
145140
let host = Host::new(sh)?;
146141
let timestamp = SystemTime::now();
147142
let revision = cmd!(sh, "git rev-parse HEAD").read()?;
148-
let perf_revision = "c52ee623e231e7690a93be88d943016968c1036b".into();
143+
let perf_revision = "a584462e145a0c04760fd9391daefb4f6bd13a99".into();
149144
Ok(Metrics { host, timestamp, revision, perf_revision, metrics: BTreeMap::new() })
150145
}
151146

0 commit comments

Comments
 (0)