Repository navigation
Avoid instantiating FnSig when not necessary - #165863
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Avoid instantiating `FnSig` when not necessary
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (15c8031): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.4%, secondary 1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.0%, secondary -11.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 482.212s -> 481.954s (-0.05%) |
This comment has been minimized.
This comment has been minimized.
4d5b1d2 to
9c20e78
Compare
|
LLM disclosure: this PR involve LLM analysis of profiles. I wrote the code and text myself. |
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
It's left over from an earlier cleanup.
9c20e78 to
4e22b4e
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I fixed the "njn:" comments. Should be ready to go now. |
4e22b4e to
cfbe932
Compare
|
I addressed the two latest suggestions. |
In various places we call `fn_sig`, which is expensive because it instantiates the signature, but then only look at the ABI or the safety, which don't require the instantiation. This commit introduces `fn_sig_abi` and `fn_sig_safety` which are alternatives that skip instantiation. In `check_instance_abi` the commit also changes `instance.ty(...)` to `tcx.type_of(...)` to avoid a second unnecessary instantiation path.
cfbe932 to
5465832
Compare
|
@bors r+ |
|
Creating a perf-sensitive rollup |
…uwer Rollup of 4 perf-sensitive pull requests Successful merges: - #165396 (Perf - Separate flag computation & intern functions per `TyKind`) - #165774 (Auto trait finder: Avoid recomputing `ParamEnv` if nothing changed) - #165863 (Avoid instantiating `FnSig` when not necessary) - #166084 (Avoid unnecessary LLVM passes when thin LTO buffer is null)
Rollup merge of #165863 - nnethercote:avoid-instantiating-FnSig, r=bjorn3 Avoid instantiating `FnSig` when not necessary In various places we call `fn_sig`, which is expensive because it instantiates the signature, but then only look at the ABI or the safety, which don't require the instantiation. This commit introduces `fn_sig_abi` and `fn_sig_safety` which are alternatives that skip instantiation. In `check_instance_abi` the commit also changes `instance.ty(...)` to `tcx.type_of(...)` to avoid a second unnecessary instantiation path. r? @bjorn3
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (14824e2): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.8%, secondary -0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.6%, secondary 1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Artifact size: 405.23 MiB -> 405.27 MiB (0.01%) |
View all comments
In various places we call
fn_sig, which is expensive because it instantiates the signature, but then only look at the ABI or the safety, which don't require the instantiation. This commit introducesfn_sig_abiandfn_sig_safetywhich are alternatives that skip instantiation.In
check_instance_abithe commit also changesinstance.ty(...)totcx.type_of(...)to avoid a second unnecessary instantiation path.r? @bjorn3