Closed jyn514 closed 2 years ago
Mentoring instructions: Change https://github.com/rust-lang/rust/blob/05d22212e89588e7c443cc6b9bc0e4e02fdfbc8d/compiler/rustc_data_structures/src/profiling.rs#L652 to only call print_time_passes_entry
if start_time.elapsed()
is longer than 5 ms.
@rustbot label: +E-easy +E-mentor
@rustbot claim
Hello @jyn514!
This is the first time I contribute to the rust project. I think I understand what is required to do, basically filtering out the passes and only keep the ones that take more than 5 milliseconds. Should I just add an if condition to the print function, and should the condition be hardcoded or configurable?
For now I think hardcoded is fine; eventually it would be nice to make it configurable, the same way it is for summarize
.
cc @rylev , I think you've been doing a fair amount of performance work - do you have opinions?
I don't have strong opinions here, but I also don't use -Ztime-passes
a lot.
Right now,
-Ztime-passes
has very long output, most of which is completely useless for determining which part of your crate is slow:It would be great to make self-profile smarter and only prints passes that take more than x milliseconds (.005 seconds seems like a reasonable cutoff). Then most lines would be trimmed but long running lints would still show up. It will still be possible to see the full information by running
-Zself-profile
, which is recommended for heavy-duty profiling anyway since it gives you more tools around the collected data.Originally posted by @jyn514 in https://github.com/rust-lang/rust/issues/79953#issuecomment-743708396