Skip to content

Conversation

@madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Nov 13, 2025

Reland #146627 after fixing the performance regression that caused it to be reverted in #148896.

This avoids 65f0b7a (second commit in the initial PR), and adds a comment explaining why extern crate is needed here instead of use (we need to load tikv_jemalloc_sys from the sysroot for some reason).

r? Kobzol

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

madsmtm commented Nov 13, 2025

I could reproduce the performance regression locally, let's see if rustc-perf agrees:

@bors try
@rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 13, 2025
Fix performance regression with jemalloc
@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 13, 2025
@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 14, 2025

☀️ Try build successful (CI)
Build commit: f30bc23 (f30bc23f4189bac695183835d28078b38cf28d74, parent: 2286e5d224b3413484cf4f398a9f078487e7b49d)

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 14, 2025
@madsmtm
Copy link
Contributor Author

madsmtm commented Nov 14, 2025

@bors try
@rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 14, 2025
Fix performance regression with jemalloc
@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 14, 2025
@rust-bors
Copy link

rust-bors bot commented Nov 14, 2025

☀️ Try build successful (CI)
Build commit: aef7be6 (aef7be6c425e18433bd4afc8a6ffcccfe9ffe796, parent: 7a72c5459dd58f81b0e1a0e5436d145485889375)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (aef7be6): comparison URL.

Overall result: no relevant changes - 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

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

Max RSS (memory usage)

Results (primary -0.6%)

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

mean range count
Regressions ❌
(primary)
7.2% [7.2%, 7.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-8.5% [-8.5%, -8.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.6% [-8.5%, 7.2%] 2

Cycles

Results (secondary 2.2%)

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.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 475.201s -> 474.025s (-0.25%)
Artifact size: 388.70 MiB -> 388.66 MiB (-0.01%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Nov 14, 2025
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a great cleanup.

Feel free to r=me once you undraft the PR.

View changes since this review

/// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs
/// and https://github.com/rust-lang/rust/pull/146627 for why we need this `use` statement.
#[cfg(any(target_os = "linux", target_os = "macos"))]
use tikv_jemalloc_sys as _;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would extern crate be needed here too instead of the use?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, miri already uses tikv_jemalloc_sys from Cargo, so extern crate and use work the same here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean Miri suffers from the cc-rs issue? The comment in clippy seems to say that the extern crate thing is needed to avoid the cc-rs issue.

@madsmtm
Copy link
Contributor Author

madsmtm commented Nov 15, 2025

Updated the PR description and title, though I'm gonna wait with merging this until #148957 is done.

@rustbot blocked

@madsmtm madsmtm marked this pull request as ready for review November 15, 2025 20:14
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

The Miri subtree was changed

cc @rust-lang/miri

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 15, 2025
@madsmtm madsmtm changed the title Fix performance regression with jemalloc Simplify jemalloc setup (without perf regression) Nov 15, 2025
Using the new `override_allocator_on_supported_platforms` feature in
`tikv-jemalloc-sys v0.6.1` we can avoid the manual statics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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