@@ -947,19 +947,26 @@ impl Benchmark {
947
947
) -> anyhow:: Result < ( ) > {
948
948
let iterations = cmp:: min ( iterations, self . config . runs ) ;
949
949
950
- if self . config . disabled {
950
+ if self . config . disabled || build_kinds . is_empty ( ) {
951
951
eprintln ! ( "Skipping {}: disabled" , self . name) ;
952
952
bail ! ( "disabled benchmark" ) ;
953
953
}
954
954
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
+
955
963
for & build_kind in build_kinds {
956
964
eprintln ! ( "Running {}: {:?} + {:?}" , self . name, build_kind, run_kinds) ;
957
965
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) ?;
963
970
self . mk_cargo_process ( compiler, prep_dir. path ( ) , build_kind)
964
971
. run_rustc ( ) ?;
965
972
0 commit comments