@@ -39,27 +39,46 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) {
3939 let rustc_clif = & compiler. rustc ;
4040 let rustflags = & compiler. rustflags . join ( "\x1f " ) ;
4141 let manifest_path = SIMPLE_RAYTRACER_REPO . source_dir ( ) . to_path ( dirs) . join ( "Cargo.toml" ) ;
42- let target_dir = dirs. build_dir . join ( "simple_raytracer" ) ;
42+ let target_dir = dirs. build_dir . join ( "simple-raytracer_target" ) ;
43+
44+ let raytracer_cg_llvm = dirs
45+ . build_dir
46+ . join ( get_file_name ( & compiler. rustc , "raytracer_cg_llvm" , "bin" ) )
47+ . to_str ( )
48+ . unwrap ( )
49+ . to_owned ( ) ;
50+ let raytracer_cg_clif = dirs
51+ . build_dir
52+ . join ( get_file_name ( & compiler. rustc , "raytracer_cg_clif" , "bin" ) )
53+ . to_str ( )
54+ . unwrap ( )
55+ . to_owned ( ) ;
56+ let raytracer_cg_clif_opt = dirs
57+ . build_dir
58+ . join ( get_file_name ( & compiler. rustc , "raytracer_cg_clif_opt" , "bin" ) )
59+ . to_str ( )
60+ . unwrap ( )
61+ . to_owned ( ) ;
4362
4463 let clean_cmd = format ! (
4564 "RUSTC=rustc cargo clean --manifest-path {manifest_path} --target-dir {target_dir}" ,
4665 manifest_path = manifest_path. display( ) ,
4766 target_dir = target_dir. display( ) ,
4867 ) ;
4968 let llvm_build_cmd = format ! (
50- "RUSTC=rustc cargo build --manifest-path {manifest_path} --target-dir {target_dir} && (rm build/ raytracer_cg_llvm || true) && ln build/simple_raytracer/ debug/main build/ raytracer_cg_llvm" ,
69+ "RUSTC=rustc cargo build --manifest-path {manifest_path} --target-dir {target_dir} && (rm { raytracer_cg_llvm} || true) && ln {target_dir}/ debug/main { raytracer_cg_llvm} " ,
5170 manifest_path = manifest_path. display( ) ,
5271 target_dir = target_dir. display( ) ,
5372 ) ;
5473 let clif_build_cmd = format ! (
55- "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\" {rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} && (rm build/ raytracer_cg_clif || true) && ln build/simple_raytracer/ debug/main build/ raytracer_cg_clif" ,
74+ "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\" {rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} && (rm { raytracer_cg_clif} || true) && ln {target_dir}/ debug/main { raytracer_cg_clif} " ,
5675 cargo_clif = cargo_clif. display( ) ,
5776 rustc_clif = rustc_clif. display( ) ,
5877 manifest_path = manifest_path. display( ) ,
5978 target_dir = target_dir. display( ) ,
6079 ) ;
6180 let clif_build_opt_cmd = format ! (
62- "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\" {rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} --release && (rm build/ raytracer_cg_clif_opt || true) && ln build/simple_raytracer/ release/main build/ raytracer_cg_clif_opt" ,
81+ "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\" {rustflags}\" CARGO_BUILD_INCREMENTAL=true {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} --release && (rm { raytracer_cg_clif_opt} || true) && ln {target_dir}/ release/main { raytracer_cg_clif_opt} " ,
6382 cargo_clif = cargo_clif. display( ) ,
6483 rustc_clif = rustc_clif. display( ) ,
6584 manifest_path = manifest_path. display( ) ,
@@ -92,24 +111,13 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) {
92111
93112 let bench_run_markdown = dirs. build_dir . join ( "bench_run.md" ) ;
94113
95- let raytracer_cg_llvm =
96- Path :: new ( "." ) . join ( get_file_name ( & compiler. rustc , "raytracer_cg_llvm" , "bin" ) ) ;
97- let raytracer_cg_clif =
98- Path :: new ( "." ) . join ( get_file_name ( & compiler. rustc , "raytracer_cg_clif" , "bin" ) ) ;
99- let raytracer_cg_clif_opt =
100- Path :: new ( "." ) . join ( get_file_name ( & compiler. rustc , "raytracer_cg_clif_opt" , "bin" ) ) ;
101- let mut bench_run = hyperfine_command (
114+ let bench_run = hyperfine_command (
102115 0 ,
103116 bench_runs,
104117 None ,
105- & [
106- ( "" , raytracer_cg_llvm. to_str ( ) . unwrap ( ) ) ,
107- ( "" , raytracer_cg_clif. to_str ( ) . unwrap ( ) ) ,
108- ( "" , raytracer_cg_clif_opt. to_str ( ) . unwrap ( ) ) ,
109- ] ,
118+ & [ ( "" , & raytracer_cg_llvm) , ( "" , & raytracer_cg_clif) , ( "" , & raytracer_cg_clif_opt) ] ,
110119 & bench_run_markdown,
111120 ) ;
112- bench_run. current_dir ( & dirs. build_dir ) ;
113121 spawn_and_wait ( bench_run) ;
114122
115123 if let Some ( gha_step_summary) = gha_step_summary. as_mut ( ) {
0 commit comments