Repository navigation
Rollup of 3 perf-sensitive pull requests - #164285
Conversation
…them as arguments
Make arg_pos to Option<u16> instead of Option<u32> And add a has_arg_pos_const in generics, so we can have shortcircuit
It has a single call site.
Doing it before `scrape_region_constraints` avoids creating a snapshot and lots of other work that doesn't do anything.
…ent-const-generics, r=khyperia Support function args const generics This PR adds initial support for argument-position const generics behind the `function_arg_const_generics` feature gate. It allows const generics to be declared directly in function arguments. The PR adds the basic plumbing across AST, HIR, and `ty`, parses these parameters into the function's generics, lowers call arguments into consts. For now, we lower literals, negated literals, const parameters, const items, unit variants, and etc, This works for functions, methods and a couple of more cases. r? @BoxyUwU cc: @khyperia
…r=scottmcm perf: drop error in `unwrap_failed` instead of `unwrap` Context: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/40-byte.20copy.20of.20unwrapped.20Result.3CT.2C.20.28.29.3E.20payload.20survives.20-O3/with/630360641 This PR changes `Result::unwrap` to pass the error by value into `unwrap_failed` rather than by reference. This makes `unwrap` no longer responsible for dropping the error after `unwrap_failed` panics, which reduces code size and compilation times and enables MIR-inlining of `unwrap`. The downside is that it introduces another function that must be monomorphized per error type (though the formatting part stays polymorphic); but it turned out to be a net perf win. I tried keeping the `unwrap_failed` fully polymorphic by passing the error as `&mut ManuallyDrop<dyn Debug>`, but this turned out to be worse for performance. [The first perf run](rust-lang#164059 (comment)) matches the current state of this PR ([the second one](rust-lang#164059 (comment)) is for the ManuallyDrop implementation that turned out to be slower). Generated code comparison (with an example of an error that has a destructor so that the landing pad shows up in the assembly post-LLVM): https://rust.godbolt.org/z/ajjYMTc7Y Old: ```asm push r14 push rbx sub rsp, 24 cmp qword ptr [rsi], -1 je .LBB5_1 mov rax, qword ptr [rsi + 16] mov qword ptr [rdi + 16], rax movups xmm0, xmmword ptr [rsi] movups xmmword ptr [rdi], xmm0 mov rax, rdi add rsp, 24 pop rbx pop r14 ret .LBB5_1: mov eax, dword ptr [rsi + 8] mov dword ptr [rsp + 4], eax lea rdi, [rip + .Lanon.99b5833966418e083b8bdda9f0bfd3cb.1] lea rcx, [rip + .Lanon.99b5833966418e083b8bdda9f0bfd3cb.0] lea r8, [rip + .Lanon.99b5833966418e083b8bdda9f0bfd3cb.8] lea r14, [rsp + 4] mov esi, 43 mov rdx, r14 call qword ptr [rip + core[a9090a07a7fa7517]::result::unwrap_failed@GOTPCREL] ud2 mov rbx, rax mov qword ptr [rsp + 8], r14 mov rax, qword ptr [rip + <i32 as core[a9090a07a7fa7517]::fmt::Display>::fmt@GOTPCREL] mov qword ptr [rsp + 16], rax lea rdi, [rip + .Lanon.99b5833966418e083b8bdda9f0bfd3cb.11] lea rsi, [rsp + 8] call qword ptr [rip + std[c29fa2d9dbea2b0e]::io::stdio::_print@GOTPCREL] mov rdi, rbx call _Unwind_Resume@PLT call qword ptr [rip + core[a9090a07a7fa7517]::panicking::panic_in_cleanup@GOTPCREL] ``` New: ```asm example[32c4274de85e6574]::generic::unwrap: cmp qword ptr [rsi], -1 je .LBB7_2 mov rax, qword ptr [rsi + 16] mov qword ptr [rdi + 16], rax movups xmm0, xmmword ptr [rsi] movups xmmword ptr [rdi], xmm0 mov rax, rdi ret .LBB7_2: push rax mov edx, dword ptr [rsi + 8] lea rdi, [rip + .Lanon.99b5833966418e083b8bdda9f0bfd3cb.1] lea rcx, [rip + .Lanon.99b5833966418e083b8bdda9f0bfd3cb.10] mov esi, 43 call example[32c4274de85e6574]::generic::unwrap_failed::<example[32c4274de85e6574]::Error> ```
…turn, r=lcnr Move `fully_perform` early return earlier Two cleanup commits and then a performance improvement. Details in the commit messages. r? @lcnr
This comment has been minimized.
This comment has been minimized.
Rollup of 3 pull requests try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu try-job: test-x86_64-gnu-llvm-22-3
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test for 75d1234 failed: CI. Failed job:
|
|
@bors try jobs=dist-x86_64-msvc |
This comment has been minimized.
This comment has been minimized.
Rollup of 3 perf-sensitive pull requests try-job: dist-x86_64-msvc
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 2d37576 (parent) -> d8ef4f3 (this PR) Test differencesShow 107 test diffsStage 1
Stage 2
Additionally, 82 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard d8ef4f3fe7031514cbd7d056b7b058814987ecec --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (d8ef4f3): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@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 -2.5%, secondary 0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.6%, secondary -3.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 487.613s -> 488.218s (0.12%) |
|
📌 Perf builds for each rolled up PR:
parent commit: 2d37576c3d In the case of a perf regression, run the following command with the SHAs of each PR you suspect might be the cause: |
|
@rust-timer triage all |
Running triage with 50 benchmarksTriage only executes the benchmarks on rollup members, that were changed significantly on the rollup.
#162727 91a47b5 Support function args const genericsInstruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -3.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -2.4%)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. #164059 6df81ab perf: drop error in
|
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
0.9% | [0.6%, 1.2%] | 3 |
| Regressions ❌ (secondary) |
0.7% | [0.6%, 0.8%] | 2 |
| Improvements ✅ (primary) |
-0.3% | [-1.5%, -0.1%] | 81 |
| Improvements ✅ (secondary) |
-0.3% | [-0.8%, -0.1%] | 38 |
| All ❌✅ (primary) | -0.2% | [-1.5%, 1.2%] | 84 |
Max RSS (memory usage)
This perf run didn't have relevant results for this metric.
Cycles
This perf run didn't have relevant results for this metric.
Binary size
Results (primary 0.1%, secondary 0.1%)
A less reliable metric. May be of interest, but not used to determine the overall result above.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
0.6% | [0.0%, 1.2%] | 13 |
| Regressions ❌ (secondary) |
1.0% | [0.9%, 1.2%] | 2 |
| Improvements ✅ (primary) |
-0.7% | [-1.4%, -0.4%] | 10 |
| Improvements ✅ (secondary) |
-0.5% | [-0.5%, -0.5%] | 3 |
| All ❌✅ (primary) | 0.1% | [-1.4%, 1.2%] | 23 |
#164236 2539b7d Move fully_perform early return earlier
Instruction count
Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
0.3% | [0.3%, 0.3%] | 1 |
| Regressions ❌ (secondary) |
- | - | 0 |
| Improvements ✅ (primary) |
-1.0% | [-3.4%, -0.1%] | 121 |
| Improvements ✅ (secondary) |
-1.3% | [-4.1%, -0.2%] | 127 |
| All ❌✅ (primary) | -1.0% | [-3.4%, 0.3%] | 122 |
Max RSS (memory usage)
This perf run didn't have relevant results for this metric.
Cycles
Results (primary -2.9%, secondary -3.1%)
A less reliable metric. May be of interest, but not used to determine the overall result above.
| mean | range | count | |
|---|---|---|---|
| Regressions ❌ (primary) |
- | - | 0 |
| Regressions ❌ (secondary) |
3.5% | [3.5%, 3.5%] | 1 |
| Improvements ✅ (primary) |
-2.9% | [-4.0%, -2.4%] | 10 |
| Improvements ✅ (secondary) |
-3.3% | [-5.1%, -2.0%] | 29 |
| All ❌✅ (primary) | -2.9% | [-4.0%, -2.4%] | 10 |
Binary size
This perf run didn't have relevant results for this metric.
Successful merges:
unwrap_failedinstead ofunwrap#164059 (perf: drop error inunwrap_failedinstead ofunwrap)fully_performearly return earlier #164236 (Movefully_performearly return earlier)r? @ghost
Create a similar rollup