Skip to content

Commit 9015109

Browse files
committed
Auto merge of #5316 - matklad:profile-important-things, r=alexcrichton
Add profiling calls to stuff which is actually slow So these two functions is what makes no-op build slow, so let's profile them to be able to track regressions better in the future.
2 parents e3169e2 + 649f0b7 commit 9015109

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/cargo/ops/cargo_rustc/context/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
197197
/// Ensure that we've collected all target-specific information to compile
198198
/// all the units mentioned in `units`.
199199
fn probe_target_info(&mut self) -> CargoResult<()> {
200+
let _p = profile::start("Context::probe_target_info");
200201
debug!("probe_target_info");
201202
let host_target_same = match self.requested_target() {
202203
Some(s) if s != self.config.rustc()?.host => false,

src/cargo/util/rustc.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::path::PathBuf;
22

3-
use util::{self, internal, CargoResult, ProcessBuilder};
3+
use util::{self, internal, profile, CargoResult, ProcessBuilder};
44

55
/// Information on the `rustc` executable
66
#[derive(Debug)]
@@ -23,6 +23,8 @@ impl Rustc {
2323
/// If successful this function returns a description of the compiler along
2424
/// with a list of its capabilities.
2525
pub fn new(path: PathBuf, wrapper: Option<PathBuf>) -> CargoResult<Rustc> {
26+
let _p = profile::start("Rustc::new");
27+
2628
let mut cmd = util::process(&path);
2729
cmd.arg("-vV");
2830

0 commit comments

Comments
 (0)