Skip to content

Conversation

@Kobzol
Copy link
Member

@Kobzol Kobzol commented Aug 13, 2025

This PR dogfoods the -Zno-embed-metadata flag in the standard library. This removes the .rmeta portion out of the libstd.so file, thus reducing its filesize on disk. Notably, this reduces the amount of MiB that we ship to people who download the standard library.

I think that the only way to find out what this breaks is to try to run full CI, and then try to land it on nightly :)

r? @ghost

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc 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) labels Aug 13, 2025
@Kobzol
Copy link
Member Author

Kobzol commented Aug 13, 2025

@bors try

rust-bors bot added a commit that referenced this pull request Aug 13, 2025
Dogfood `-Zno-embed-metadata` in the compiler
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 13, 2025

☀️ Try build successful (CI)
Build commit: 6edf4f5 (6edf4f50158d893f8aa51ea5a04ba02370776b95, parent: b1b26b834d85e84b46aa8f8f3ce210a1627aa85f)

@Kobzol
Copy link
Member Author

Kobzol commented Aug 13, 2025

@rust-timer build 6edf4f5

@rust-timer

This comment has been minimized.

@Kobzol Kobzol force-pushed the dogfood-z-no-embed-metadata branch from 74ef778 to ce49790 Compare August 13, 2025 14:27
@rust-log-analyzer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6edf4f5): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.7% [0.2%, 1.2%] 7
Regressions ❌
(secondary)
0.4% [0.1%, 0.9%] 43
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.5%, -0.0%] 3
All ❌✅ (primary) 0.7% [0.2%, 1.2%] 7

Max RSS (memory usage)

Results (primary -0.7%, secondary -0.8%)

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

mean range count
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
2.7% [2.3%, 3.2%] 4
Improvements ✅
(primary)
-1.4% [-2.3%, -0.5%] 3
Improvements ✅
(secondary)
-2.5% [-5.2%, -0.8%] 8
All ❌✅ (primary) -0.7% [-2.3%, 1.3%] 4

Cycles

Results (primary 3.6%, secondary 3.7%)

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

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

Binary size

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

Bootstrap: 464.328s -> 465.28s (0.21%)
Artifact size: 377.44 MiB -> 377.37 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 13, 2025
@bors
Copy link
Collaborator

bors commented Aug 14, 2025

☔ The latest upstream changes (presumably #145366) made this pull request unmergeable. Please resolve the merge conflicts.

@Kobzol Kobzol force-pushed the dogfood-z-no-embed-metadata branch from ce49790 to 412cf87 Compare August 25, 2025 13:22
@Kobzol
Copy link
Member Author

Kobzol commented Aug 25, 2025

@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 Aug 25, 2025
Dogfood `-Zno-embed-metadata` in the compiler
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 25, 2025
@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol force-pushed the dogfood-z-no-embed-metadata branch from 412cf87 to 70e90f9 Compare August 25, 2025 14:21
@Kobzol
Copy link
Member Author

Kobzol commented Aug 25, 2025

@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 Aug 25, 2025
Dogfood `-Zno-embed-metadata` in the compiler
@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Member Author

Kobzol commented Aug 25, 2025

@bors try @rust-timer queue

@Kobzol
Copy link
Member Author

Kobzol commented Dec 9, 2025

r? @bjorn3

@Kobzol Kobzol marked this pull request as ready for review December 9, 2025 14:20
@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 Dec 9, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Dec 10, 2025

☔ The latest upstream changes (presumably #149836) made this pull request unmergeable. Please resolve the merge conflicts.

@Kobzol
Copy link
Member Author

Kobzol commented Dec 29, 2025

@bors2 r+

(Just testing new bors)

@rust-bors
Copy link

rust-bors bot commented Dec 29, 2025

📌 Commit b143030 has been approved by Kobzol

It is now in the queue for this repository.

@Kobzol
Copy link
Member Author

Kobzol commented Dec 29, 2025

@bors2 r-

@rust-bors
Copy link

rust-bors bot commented Dec 29, 2025

Commit b143030 has been unapproved.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Jan 2, 2026
@rustbot

This comment has been minimized.

Kobzol and others added 2 commits January 2, 2026 10:27
@Kobzol Kobzol force-pushed the dogfood-z-no-embed-metadata branch from afef2c7 to 64bd438 Compare January 2, 2026 09:28
@rustbot
Copy link
Collaborator

rustbot commented Jan 2, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Member Author

Kobzol commented Jan 2, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jan 2, 2026
Dogfood `-Zno-embed-metadata` in the standard library
@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 Jan 2, 2026
@rust-bors
Copy link

rust-bors bot commented Jan 2, 2026

☀️ Try build successful (CI)
Build commit: 0dfbe35 (0dfbe35c2f554bb94fb5ece5a7da73b275a5bc94, parent: 1b4325211c3228dd10eea12e9b3f749f87363d95)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0dfbe35): comparison URL.

Overall result: ❌ regressions - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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%, 1.2%] 7
Regressions ❌
(secondary)
0.3% [0.1%, 0.9%] 52
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 0.8% [0.2%, 1.2%] 7

Max RSS (memory usage)

Results (primary 0.3%, secondary -1.0%)

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

mean range count
Regressions ❌
(primary)
1.6% [1.6%, 1.6%] 1
Regressions ❌
(secondary)
1.2% [0.7%, 1.9%] 6
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
-3.5% [-4.8%, -2.1%] 5
All ❌✅ (primary) 0.3% [-1.0%, 1.6%] 2

Cycles

Results (secondary 0.6%)

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.6% [2.3%, 3.0%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-3.6%, -1.3%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 472.736s -> 473.671s (0.20%)
Artifact size: 390.80 MiB -> 382.61 MiB (-2.10%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 2, 2026
@Kobzol
Copy link
Member Author

Kobzol commented Jan 2, 2026

The performance regression exists only for the most trivial crates and benchmarks that are almost empty. I think that they are caused by rustc now scanning an additional .rmeta stdlib file with the metadata:

   85,803    <&std::path::PathBuf as core::hash::Hash>::hash::<rustc_hash::FxHasher>
   44,811    emap_try_acquire_edata_neighbor
  -27,503    extent_try_coalesce_impl
    9,281    <rustc_metadata::locator::CrateLocator>::find_library_crate
    8,461    free
   -7,779    <object::read::any::File>::parse
    7,582    <rustc_session::search_paths::SearchPath>::new
   -7,000    <object::read::elf::section::SectionTable<object::elf::FileHeader64<object::endian::Endianness>>>::symbols
    6,820    realloc
    6,604    malloc
   -6,440    <object::read::archive::ArchiveMember>::parse::<&[u8]>

The libstd.so size difference:

@Kobzol
Copy link
Member Author

Kobzol commented Jan 2, 2026

@rustbot ready

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

Labels

A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants