@@ -16,11 +16,7 @@ static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
16
16
"<none>" ,
17
17
) ;
18
18
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 ) {
24
20
if std:: process:: Command :: new ( "hyperfine" ) . output ( ) . is_err ( ) {
25
21
eprintln ! ( "Hyperfine not installed" ) ;
26
22
eprintln ! ( "Hint: Try `cargo install hyperfine` to install hyperfine" ) ;
@@ -39,9 +35,9 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
39
35
} ;
40
36
41
37
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 " ) ;
45
41
let manifest_path = SIMPLE_RAYTRACER_REPO . source_dir ( ) . to_path ( dirs) . join ( "Cargo.toml" ) ;
46
42
let target_dir = dirs. build_dir . join ( "simple_raytracer" ) ;
47
43
@@ -56,22 +52,24 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
56
52
target_dir = target_dir. display( ) ,
57
53
) ;
58
54
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" ,
60
56
cargo_clif = cargo_clif. display( ) ,
57
+ rustc_clif = rustc_clif. display( ) ,
61
58
manifest_path = manifest_path. display( ) ,
62
59
target_dir = target_dir. display( ) ,
63
60
) ;
64
61
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" ,
66
63
cargo_clif = cargo_clif. display( ) ,
64
+ rustc_clif = rustc_clif. display( ) ,
67
65
manifest_path = manifest_path. display( ) ,
68
66
target_dir = target_dir. display( ) ,
69
67
) ;
70
68
71
69
let bench_compile_markdown = dirs. dist_dir . join ( "bench_compile.md" ) ;
72
70
73
71
let bench_compile = hyperfine_command (
74
- 1 ,
72
+ 0 ,
75
73
bench_runs,
76
74
Some ( & clean_cmd) ,
77
75
& [
@@ -94,21 +92,12 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
94
92
95
93
let bench_run_markdown = dirs. dist_dir . join ( "bench_run.md" ) ;
96
94
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" ) ) ;
112
101
let mut bench_run = hyperfine_command (
113
102
0 ,
114
103
bench_runs,
0 commit comments