Skip to content

[experiment] purnau - #158917

Draft
WaffleLapkin wants to merge 10 commits into
rust-lang:mainfrom
WaffleLapkin:push-ouqxxznmmkuv
Draft

[experiment] purnau#158917
WaffleLapkin wants to merge 10 commits into
rust-lang:mainfrom
WaffleLapkin:push-ouqxxznmmkuv

Conversation

@WaffleLapkin

Copy link
Copy Markdown
Member

No description provided.

I verified that this doesn't pessimize codegen using the example from the
PR that inroduced the optimization of `next_chunk` (# 149131):

```rust
#![feature(iter_next_chunk)]

#[no_mangle]
pub fn simd_sum_slow(arr: &[u32]) -> u32 {
    const STEP_SIZE: usize = 16;

    let mut result = [0; STEP_SIZE];

    let mut iter = arr.iter();

    while let Ok(c) = iter.next_chunk::<STEP_SIZE>() {
        for (&n, r) in c.iter().zip(result.iter_mut()) {
            *r += n;
        }
    }

    result.iter().sum()
}
```

I compiled this example with
```shell
./build/host/stage1/bin/rustc t.rs --emit=asm -O --crate-type=lib
```

Before and after this change; the only difference is the choice of the
jump instruction, which I think shouldn't make any difference:

```diff
28,29c28,29
< 	cmpq	$64, %rsi
< 	jae	.LBB0_2
---
> 	cmpq	$60, %rsi
> 	ja	.LBB0_2
```
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 7, 2026
@WaffleLapkin

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 7, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 4213105 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6993 files
tidy check
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
tidy [style (library)]: /checkout/library/core/src/slice/iter.rs:120: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter.rs:265: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:61: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:76: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:88: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:113: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:141: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:145: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:157: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:214: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw.rs:487: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw/end_or_len.rs:41: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw/end_or_len.rs:43: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw/end_or_len.rs:51: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/raw/end_or_len.rs:53: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:33: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:40: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:44: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:61: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:79: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:172: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/slice/iter/macros.rs:209: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/array/iter.rs:234: undocumented unsafe
tidy [style (library)]: /checkout/library/core/src/array/iter/iter_inner.rs:102: undocumented unsafe
tidy [style (library)]: FAIL
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (26.1.2)
linting python files
---
   ╭▸ library/core/src/slice/iter/raw/end_or_len.rs:11:71
   │
11 │ /// But, as it stands, we have to resort to using this only as a more convinient way of accessing
   ╰╴                                                                      ━━━━━━━━━━
rerun with `--bless` to fix typos: `./x.py test tidy --extra-checks=spellcheck --bless`
tidy [extra_checks:spellcheck]: checks with external tool 'typos' failed
tidy [extra_checks:spellcheck]: FAIL
yarn install v1.22.22
warning package.json: No license field
warning ../../package.json: License should be a valid SPDX license expression
warning No license field
[1/4] Resolving packages...
---
Running eslint on rustdoc JS files
info: ES-Check: checking 7 files...
info: ✓ ES-Check passed! All files are ES10 compatible.
typechecking javascript files
tidy: The following checks failed: extra_checks:spellcheck, style (library)
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/checkout --cargo-path=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/checkout/obj/build --concurrency=4 --npm-path=/node/bin/yarn --ci=true --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1625:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1646:29

--- BACKTRACE vvv
   0: <bootstrap::utils::exec::DeferredCommand>::finish_process
             at /checkout/src/bootstrap/src/utils/exec.rs:939:17
   1: <bootstrap::utils::exec::DeferredCommand>::wait_for_output::<&bootstrap::utils::exec::ExecutionContext>
             at /checkout/src/bootstrap/src/utils/exec.rs:831:21
   2: <bootstrap::utils::exec::ExecutionContext>::run
             at /checkout/src/bootstrap/src/utils/exec.rs:741:45
   3: <bootstrap::utils::exec::BootstrapCommand>::run::<&bootstrap::core::builder::Builder>
             at /checkout/src/bootstrap/src/utils/exec.rs:339:27
   4: <bootstrap::core::build_steps::test::Tidy as bootstrap::core::builder::Step>::run
             at /checkout/src/bootstrap/src/core/build_steps/test.rs:1646:29
   5: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::test::Tidy>
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1607:36
   6: <bootstrap::core::build_steps::test::Tidy as bootstrap::core::builder::Step>::make_run
             at /checkout/src/bootstrap/src/core/build_steps/test.rs:1568:21
   7: <bootstrap::core::builder::StepDescription>::maybe_run
             at /checkout/src/bootstrap/src/core/builder/mod.rs:476:13
   8: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at /checkout/src/bootstrap/src/core/builder/cli_paths.rs:232:18
   9: <bootstrap::core::builder::Builder>::run_step_descriptions
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1140:9
  10: <bootstrap::core::builder::Builder>::execute_cli
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1119:14
  11: <bootstrap::Build>::build
             at /checkout/src/bootstrap/src/lib.rs:803:25
  12: bootstrap::main
             at /checkout/src/bootstrap/src/bin/main.rs:130:11
  13: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/core/src/ops/function.rs:250:5
  14: std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/sys/backtrace.rs:166:18
  15: std::rt::lang_start::<()>::{closure#0}
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:206:18
  16: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/core/src/ops/function.rs:287:21
  17: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:581:40
  18: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:544:19
  19: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panic.rs:359:14
  20: std::rt::lang_start_internal::{closure#0}
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/rt.rs:175:24
  21: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library/std/src/panicking.rs:581:40
---
  28: __libc_start_main
  29: _start


Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:02:34
  local time: Tue Jul  7 18:17:04 UTC 2026
  network time: Tue, 07 Jul 2026 18:17:04 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f65824f (f65824f8656c686e990d598cd4947ac0ec7e12b9)
Base parent: f10db29 (f10db292a3733b5c67c8da8c7661195ff4b05774)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f65824f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking 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.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

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.8% [0.2%, 4.4%] 27
Regressions ❌
(secondary)
0.6% [0.0%, 4.1%] 21
Improvements ✅
(primary)
-0.6% [-1.3%, -0.2%] 19
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.3%] 2
All ❌✅ (primary) 0.2% [-1.3%, 4.4%] 46

Max RSS (memory usage)

Results (primary 2.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.0% [0.5%, 4.9%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.2% [-1.2%, -1.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.1% [-1.2%, 4.9%] 5

Cycles

Results (primary 1.3%, secondary 3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.2% [1.5%, 4.9%] 2
Regressions ❌
(secondary)
3.6% [3.6%, 3.6%] 1
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [-2.7%, 4.9%] 3

Binary size

Results (primary 0.8%, secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.0% [0.0%, 2.6%] 77
Regressions ❌
(secondary)
0.9% [0.1%, 2.6%] 68
Improvements ✅
(primary)
-0.5% [-1.2%, -0.0%] 11
Improvements ✅
(secondary)
-0.2% [-0.5%, -0.0%] 3
All ❌✅ (primary) 0.8% [-1.2%, 2.6%] 88

Bootstrap: 487.206s -> 489.175s (0.40%)
Artifact size: 388.97 MiB -> 389.01 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants