Skip to content

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Oct 12, 2025

It's a big speed win for cranelift-codegen-0.119.0.

r? @Zalathar

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 12, 2025
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 13, 2025
Add a `!=` check to `ChunkedBitSet::union`.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 13, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 13, 2025

☀️ Try build successful (CI)
Build commit: 701ca72 (701ca7229fdda54e3b2aaf5d347786d78565ec43, parent: 2300c2aef7dbc2a7bbbeaa9894d07d459abd9bc6)

@rust-timer

This comment has been minimized.

@Zalathar
Copy link
Contributor

For future work, we could hypothetically get even more clever, and try to start the bitwise_changes check from where the equality check failed (for suitable operators).

But that might not be worth the extra implementation complexity (or might even reduce the benefit of the equality check).

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (701ca72): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.7% [-9.6%, -1.3%] 6
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) -4.7% [-9.6%, -1.3%] 6

Max RSS (memory usage)

Results (primary 2.0%)

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

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [2.0%, 2.0%] 1

Cycles

Results (primary -3.3%, secondary 2.7%)

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)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-3.3% [-3.5%, -3.1%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.3% [-3.5%, -3.1%] 2

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 472.507s -> 474.412s (0.40%)
Artifact size: 388.12 MiB -> 388.13 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 13, 2025
@nnethercote
Copy link
Contributor Author

For future work, we could hypothetically get even more clever, and try to start the bitwise_changes check from where the equality check failed (for suitable operators).

But that might not be worth the extra implementation complexity (or might even reduce the benefit of the equality check).

Interesting idea! I tried it out, with code like this:

                    let i = match iter::zip(
                        &self_chunk_words[0..num_words],
                        &other_chunk_words[0..num_words],
                    )
                    .position(|(a, b)| a != b)
                    {
                        Some(i) => i,
                        None => continue, // all elements equal, nothing more to do
                    };

                    let op = |a, b| a | b;
                    if !bitwise_changes(
                        &self_chunk_words[i..num_words],
                        &other_chunk_words[i..num_words],
                        op,
                    ) {
                        continue;
                    }
                    
                    // ... do the mutation ...

And it ended up being a significant slowdown. I think because that iter::zip/position loop is much less optimized than simple slice comparison, which would use something like memcmp.

For less indentation, mostly.
It's a big speed win for cranelift-codegen-0.119.0.
@nnethercote
Copy link
Contributor Author

I have update the code a little to include some refactoring.

@nnethercote nnethercote marked this pull request as ready for review October 13, 2025 09:16
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 13, 2025
@Zalathar
Copy link
Contributor

Looks good, thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 13, 2025

📌 Commit ad8b2e0 has been approved by Zalathar

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2025
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
...........................................        (143/143)

======== tests/rustdoc-gui/globals.goml ========

[ERROR] `tests/rustdoc-gui/globals.goml` line 14: The following errors happened: [Property named `"searchIndex"` doesn't exist]: for command `assert-window-property-false: {"searchIndex": null}`

======== tests/rustdoc-gui/search-result-display.goml ========

[WARNING] `tests/rustdoc-gui/search-result-display.goml` line 39: Delta is 0 for "x", maybe try to use `compare-elements-position` instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants