Skip to content

Commit c5c270d

Browse files
Cache build dependencies for a given benchmark
1 parent c790398 commit c5c270d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

collector/src/bin/rustc-perf-collector/execute.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -947,19 +947,26 @@ impl Benchmark {
947947
) -> anyhow::Result<()> {
948948
let iterations = cmp::min(iterations, self.config.runs);
949949

950-
if self.config.disabled {
950+
if self.config.disabled || build_kinds.is_empty() {
951951
eprintln!("Skipping {}: disabled", self.name);
952952
bail!("disabled benchmark");
953953
}
954954

955+
eprintln!("Preparing {}", self.name, build_kind, run_kinds);
956+
// Build everything, including all dependent crates, in a temp dir with
957+
// the first build kind we're building for. The intent is to cache build
958+
// dependencies at least between runs.
959+
let prep_dir = self.make_temp_dir(&self.path)?;
960+
self.mk_cargo_process(compiler, prep_dir.path(), build_kinds[0])
961+
.run_rustc()?;
962+
955963
for &build_kind in build_kinds {
956964
eprintln!("Running {}: {:?} + {:?}", self.name, build_kind, run_kinds);
957965

958-
// Build everything, including all dependent crates, in a temp dir.
959-
// We do this before the iterations so that dependent crates aren't
960-
// built on every iteration. A different temp dir is used for the
961-
// timing builds.
962-
let prep_dir = self.make_temp_dir(&self.path)?;
966+
// Rebuild the prepared crates for the given profile. This shouldn't
967+
// rebuild build dependencies but will likely rebuild everything
968+
// else -- that's fine though.
969+
let prep_dir = self.make_temp_dir(&prep_dir)?;
963970
self.mk_cargo_process(compiler, prep_dir.path(), build_kind)
964971
.run_rustc()?;
965972

0 commit comments

Comments
 (0)