Skip to content

[TEST] Use global Rust jemalloc#155673

Draft
Zoxc wants to merge 6 commits intorust-lang:mainfrom
Zoxc:global-jemalloc
Draft

[TEST] Use global Rust jemalloc#155673
Zoxc wants to merge 6 commits intorust-lang:mainfrom
Zoxc:global-jemalloc

Conversation

@Zoxc
Copy link
Copy Markdown
Contributor

@Zoxc Zoxc commented Apr 23, 2026

No description provided.

@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 23, 2026
@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Apr 23, 2026

@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 Apr 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 23, 2026
[TEST] Use global Rust jemalloc
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 23, 2026

💔 Test for 64c00df failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Apr 23, 2026

On macOS 11:

BenchmarkBeforeBeforeAfter
TimeTime%Time%
🟣 regex:check1.1744s1.1759s 0.13%1.0958s💚 -6.69%
🟣 syn:check1.9310s1.9309s -0.01%1.7920s💚 -7.20%
🟣 clap:check2.0073s2.0093s 0.10%1.8822s💚 -6.23%
🟣 hyper:check0.3262s0.3260s -0.06%0.3143s💚 -3.63%
Total5.4389s5.4421s 0.06%5.0844s💚 -6.52%
Summary1.0000s1.0004s 0.04%0.9406s💚 -5.94%

Comment thread compiler/rustc_driver_impl/src/lib.rs Outdated

#[cfg(feature = "jemalloc")]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 Apr 23, 2026

Choose a reason for hiding this comment

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

This only works when libstd is statically linked into librustc_driver which we don't do on MinGW:

/// Returns if `std` should be statically linked into `rustc_driver`.
/// It's currently not done on `windows-gnu` due to linker bugs.
pub fn link_std_into_rustc_driver(&self, target: TargetSelection) -> bool {
!target.triple.ends_with("-windows-gnu")
}
If libstd is dynamically linked, this is UB as libstd and rustc may use a different allocator depending on the target and if protected visibility is used (PE and Mach-O effectively behave as if protected visibility is always used, while on ELF we may want to make -Zdefault-visibility=protected the default in the future). Rustc should probably emit an error for this case, but does not do so currently.

View changes since the review

@Zoxc Zoxc force-pushed the global-jemalloc branch from 8b811b9 to df19d99 Compare April 27, 2026 08:37
@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Apr 27, 2026

@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 Apr 27, 2026
[TEST] Use global Rust jemalloc
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

☀️ Try build successful (CI)
Build commit: ca3fc89 (ca3fc89a2aeeda43050fdebc0d92c676d4063482, parent: 2f43fe430374fce8c75d477bdb78715d5c0349c4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ca3fc89): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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.0% [0.0%, 0.0%] 3
Improvements ✅
(primary)
-0.3% [-0.8%, -0.2%] 75
Improvements ✅
(secondary)
-0.4% [-0.8%, -0.0%] 126
All ❌✅ (primary) -0.3% [-0.8%, -0.2%] 75

Max RSS (memory usage)

Results (primary 0.1%, 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.4% [1.4%, 1.4%] 1
Regressions ❌
(secondary)
2.5% [1.1%, 3.8%] 2
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) 0.1% [-1.3%, 1.4%] 2

Cycles

Results (primary 1.7%, secondary 0.5%)

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

mean range count
Regressions ❌
(primary)
1.7% [1.7%, 1.7%] 1
Regressions ❌
(secondary)
3.8% [2.2%, 6.1%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-4.0%, -1.2%] 5
All ❌✅ (primary) 1.7% [1.7%, 1.7%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 487.764s -> 489.254s (0.31%)
Artifact size: 393.48 MiB -> 394.61 MiB (0.29%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

5 participants