Skip to content

Commit 0f4df8f

Browse files
committed
Eliminate a couple of extra calls
This is an additional 17% improvement on ./y.rs compile --sysroot none Benchmark 1: ./y_before.bin build --sysroot none Time (mean ± σ): 1.533 s ± 0.022 s [User: 1.411 s, System: 0.471 s] Range (min … max): 1.517 s … 1.589 s 10 runs Benchmark 2: ./y_after.bin build --sysroot none Time (mean ± σ): 1.311 s ± 0.020 s [User: 1.232 s, System: 0.428 s] Range (min … max): 1.298 s … 1.366 s 10 runs Summary './y_after.bin build --sysroot none' ran 1.17 ± 0.02 times faster than './y_before.bin build --sysroot none'
1 parent abcff71 commit 0f4df8f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

build_system/build_sysroot.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
33
use std::process::{self, Command};
44

55
use super::path::{Dirs, RelPath};
6-
use super::rustc_info::{get_cargo_path, get_file_name, get_rustc_version, get_toolchain_name};
6+
use super::rustc_info::{get_file_name, get_rustc_version, get_toolchain_name};
77
use super::utils::{spawn_and_wait, try_hard_link, CargoProject, Compiler};
88
use super::SysrootKind;
99

@@ -36,17 +36,18 @@ pub(crate) fn build_sysroot(
3636
LIB_DIR
3737
}
3838
.to_path(dirs)
39-
.join(get_file_name("rustc_codegen_cranelift", "dylib"));
39+
.join(cg_clif_dylib_src.file_name().unwrap());
4040
try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path);
4141

4242
// Build and copy rustc and cargo wrappers
4343
let wrapper_base_name = get_file_name("____", "bin");
44+
let toolchain_name = get_toolchain_name();
4445
for wrapper in ["rustc-clif", "rustdoc-clif", "cargo-clif"] {
4546
let wrapper_name = wrapper_base_name.replace("____", wrapper);
4647

4748
let mut build_cargo_wrapper_cmd = Command::new(&bootstrap_host_compiler.rustc);
4849
build_cargo_wrapper_cmd
49-
.env("TOOLCHAIN_NAME", get_toolchain_name())
50+
.env("TOOLCHAIN_NAME", toolchain_name.clone())
5051
.arg(RelPath::SCRIPTS.to_path(dirs).join(&format!("{wrapper}.rs")))
5152
.arg("-o")
5253
.arg(DIST_DIR.to_path(dirs).join(wrapper_name))
@@ -96,7 +97,7 @@ pub(crate) fn build_sysroot(
9697
RelPath::DIST.to_path(&dirs).join(wrapper_base_name.replace("____", "rustdoc-clif"));
9798

9899
Compiler {
99-
cargo: get_cargo_path(),
100+
cargo: bootstrap_host_compiler.cargo.clone(),
100101
rustc: rustc_clif.clone(),
101102
rustdoc: rustdoc_clif.clone(),
102103
rustflags: String::new(),

0 commit comments

Comments
 (0)