@@ -16,11 +16,7 @@ static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1616 "<none>" ,
1717) ;
1818
19- pub ( crate ) fn benchmark ( dirs : & Dirs , bootstrap_host_compiler : & Compiler ) {
20- benchmark_simple_raytracer ( dirs, bootstrap_host_compiler) ;
21- }
22-
23- fn benchmark_simple_raytracer ( dirs : & Dirs , bootstrap_host_compiler : & Compiler ) {
19+ pub ( crate ) fn benchmark ( dirs : & Dirs , compiler : & Compiler ) {
2420 if std:: process:: Command :: new ( "hyperfine" ) . output ( ) . is_err ( ) {
2521 eprintln ! ( "Hyperfine not installed" ) ;
2622 eprintln ! ( "Hint: Try `cargo install hyperfine` to install hyperfine" ) ;
@@ -39,9 +35,9 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
3935 } ;
4036
4137 eprintln ! ( "[BENCH COMPILE] ebobby/simple-raytracer" ) ;
42- let cargo_clif = dirs
43- . dist_dir
44- . join ( get_file_name ( & bootstrap_host_compiler . rustc , "cargo_clif" , "bin" ) . replace ( '_' , "-" ) ) ;
38+ let cargo_clif = & compiler . cargo ;
39+ let rustc_clif = & compiler . rustc ;
40+ let rustflags = & compiler . rustflags . join ( " \x1f " ) ;
4541 let manifest_path = SIMPLE_RAYTRACER_REPO . source_dir ( ) . to_path ( dirs) . join ( "Cargo.toml" ) ;
4642 let target_dir = dirs. build_dir . join ( "simple_raytracer" ) ;
4743
@@ -56,22 +52,24 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
5652 target_dir = target_dir. display( ) ,
5753 ) ;
5854 let clif_build_cmd = format ! (
59- "RUSTC=rustc {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" ,
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" ,
6056 cargo_clif = cargo_clif. display( ) ,
57+ rustc_clif = rustc_clif. display( ) ,
6158 manifest_path = manifest_path. display( ) ,
6259 target_dir = target_dir. display( ) ,
6360 ) ;
6461 let clif_build_opt_cmd = format ! (
65- "RUSTC=rustc {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" ,
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" ,
6663 cargo_clif = cargo_clif. display( ) ,
64+ rustc_clif = rustc_clif. display( ) ,
6765 manifest_path = manifest_path. display( ) ,
6866 target_dir = target_dir. display( ) ,
6967 ) ;
7068
7169 let bench_compile_markdown = dirs. dist_dir . join ( "bench_compile.md" ) ;
7270
7371 let bench_compile = hyperfine_command (
74- 1 ,
72+ 0 ,
7573 bench_runs,
7674 Some ( & clean_cmd) ,
7775 & [
@@ -94,21 +92,12 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
9492
9593 let bench_run_markdown = dirs. dist_dir . join ( "bench_run.md" ) ;
9694
97- let raytracer_cg_llvm = Path :: new ( "." ) . join ( get_file_name (
98- & bootstrap_host_compiler. rustc ,
99- "raytracer_cg_llvm" ,
100- "bin" ,
101- ) ) ;
102- let raytracer_cg_clif = Path :: new ( "." ) . join ( get_file_name (
103- & bootstrap_host_compiler. rustc ,
104- "raytracer_cg_clif" ,
105- "bin" ,
106- ) ) ;
107- let raytracer_cg_clif_opt = Path :: new ( "." ) . join ( get_file_name (
108- & bootstrap_host_compiler. rustc ,
109- "raytracer_cg_clif_opt" ,
110- "bin" ,
111- ) ) ;
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" ) ) ;
112101 let mut bench_run = hyperfine_command (
113102 0 ,
114103 bench_runs,
0 commit comments