-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking issue for speeding up rustc via its build configuration #103595
Copy link
Copy link
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-performanceWorking group: Compiler PerformanceWorking group: Compiler Performance
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-performanceWorking group: Compiler PerformanceWorking group: Compiler Performance
Type
Fields
Give feedbackNo fields configured for issues without a type.
There are several ways to speed up rustc by changing its build configuration, without changing its code: use a single codegen unit (CGU), profile-guided optimization (PGO), link-time optimization (LTO), post-link optimization (via BOLT), and using a better allocator (e.g. jemalloc or mimalloc).
This is a tracking issue for doing these for the most popular Tier 1 platforms: Linux64 (
x86_64-unknown-linux-gnu), Win64 (x86_64-pc-windows-msvc), and Mac (x86_64-apple-darwin, and more recentlyaarch64-apple-darwin).Items marked with [2022] are on the Compiler performance roadmap for 2022.
Single CGU
Benefits: rustc is faster, uses less memory, has a smaller binary.
Costs: rustc takes longer to build.
rustcwith a single CGU on x64 Linux #115554, merged 2023-10-01.rustcwith 1CGU onx86_64-pc-windows-msvc#112267, merged 2024-03-12.rustcwith 1CGU onx86_64-apple-darwin#112268, merged 2024-03-12.rustcwith 1 CGU onaarch64-apple-darwin#133747, merged 2024-12-03.PGO
Benefits: rustc is faster.
Costs: rustc takes longer to build.
Other PGO attempts:
libstd: Apply PGO to libstd on CI #97038, no speed-up measured.LTO
Benefits: rustc is faster.
Costs: rustc takes longer to build.
x86_64-apple-darwin#103647 and Re-enable ThinLTO for rustc onx86_64-apple-darwin#105845, merged 2022-12-19.This is all thin LTO, which gets most of the benefits of fat LTO with a much lower link-time cost.
Other LTO attempts:
rustdoc: [perftest] Use LTO for compilingrustdoc#102885, no speed-up measured.rustc#103453, no speed-up measured, large CI build cost.BOLT
Benefits: rustc is faster.
Costs: rustc takes longer to build.
librustc_driver.sowith BOLT #116352, merged 2023-10-14.Bolt only works on ELF binaries, and thus is Linux-only.
Instruction set
Benefits: rustc is faster?
Costs: rustc won't run on old CPUs.
Linker
Benefits: rustc (linking) is faster.
Costs: hard to get working.
lldby default onx86_64-unknown-linux-gnu:rust-lldon nightlyx86_64-unknown-linux-gnu#124129, merged 2024-05-17Better allocator
Benefits: rustc (linking) is faster.
Costs: rustc uses more memory?
Note: #92249 and #92317 tried using two different versions of mimalloc (one 1.7-based, one 2.0-based) instead of jemalloc, but the speed/memory tradeoffs in both cases were deemed inferior (the max-rss regressions expected to be fixed in the 2.x series still exist as of 2.0.6, see #103944).
Note: we use a better allocator by simply overriding malloc/free, rather than using
#[global_allocator]. See this Zulip thread for some discussion about the sub-optimality of this.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.