-
Notifications
You must be signed in to change notification settings - Fork 82
Add Incremental System Rethought Project Goal #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+86
−0
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Incremental Systems Rethought | ||
|
|
||
| | Metadata | | | ||
| | :--------------- | -------------------------------------------------------------------------------- | | ||
| | Point of contact | @blyxyas | | ||
| | Status | Proposed | | ||
| | Tracking issue | | | ||
| | Zulip channel | N/A | | ||
|
|
||
| ## Summary | ||
|
|
||
| Design, propose, and implement a redesign of the incremental system to allow for shared common bases between different Rustc invocations with different arguments (i.e. `cargo build` and `cargo check`) | ||
|
|
||
| There's already an [on-going RFC], based on [this blog post and talk] by the same author (and this project goal's point of contact) | ||
| As my other project goals, this is a formalization of an already existing effort. | ||
|
|
||
| ## Motivation | ||
|
|
||
| The incremental system (i.e. the system that takes care of reusing the dep-graph and keeping track of changes on | ||
| compiler invocations) does not take into account inter-activity communication. So, `cargo build` and `cargo check`, | ||
| while they share a lot of common meaning and thus should share much in a perfect incremental system, in reality | ||
| trigger a recompilation if performed one after the other. | ||
|
|
||
| This project goal will design, propose and implement the necessary changes for `check`, `build` and possibly some | ||
| 3rd-parties such as `clippy` to share a common incremental ground when performed in a compatible way. | ||
|
|
||
| So, when a user runs `cargo check` and then `cargo build`, `cargo build` would reuse much of the work done by `cargo check`. | ||
| `cargo check` and `cargo clippy` (if implemented) would also reuse a lot of work. `cargo build` and `cargo test` could also | ||
| reuse some e.g. parsing information | ||
|
|
||
| ### The status quo | ||
|
|
||
| Quoting from the earlier mentioned RFC: | ||
|
|
||
| The current model for incremental recompilations doesn't share progress between compiler activities, leading to unnecessary | ||
| rebuilds. Users notice redundant compilations, as "Changes in workspaces trigger unnecessary rebuilds" was submitted as | ||
| [a big complaint in the compiler performance][perf-survey]. | ||
|
|
||
| --- | ||
|
|
||
| This affects all users that use a typical `cargo check` -> `cargo build` -> `cargo test` workflow. Even on codebases | ||
| that don't use e.g. `cfg(test)` or similar profile-based `cfg` attributes, it will rebuild the workspace 3 times. | ||
|
|
||
| Summing to the already slow compilation times, having to rebuild the workspace on every different command is a pain | ||
| point discovered in the performance survey. | ||
|
|
||
| ### The next 6 months | ||
|
|
||
| > *Sketch out the specific things you are trying to achieve in this goal period. This should be short and high-level -- we don't want to see the design!* | ||
|
|
||
| | Task | Owner(s) | Notes | | ||
| | --------------- | -------- | ----- | | ||
| | Design, propose | @blyxyas | | | ||
| | Implementation | @blyxyas | | | ||
| | ... | | | | ||
|
|
||
| ### The "shiny future" we are working towards | ||
|
|
||
| The end goal is to allow for smoother work-reutilization between compiler invocations with little to no overhead. With dynamic dependencies declaring which compiler flags are sensitive for the current codebase recompiling, and keeping an accurate track of macro invocations and a real and specific sense of which functions from dependencies the current crate depends on. | ||
|
|
||
| The shiny future, and the end goal of the whole roadmap is to avoid the following scenarios: | ||
|
|
||
| - Full recompilations on `cargo check` -> `cargo build` on all scenarios. (Some will need it due to e.g. build scripts, but the majority don't) | ||
| - Recompilations at all on `cargo build` -> `cargo check` | ||
| - Recompilations due to changes in unused functions from dependencies. | ||
| - Recompilations due to CLI flags that don't affect the current invocation (e.g. `-Clto` on `cargo check`) | ||
|
|
||
| The first step is completing the RFC and implementing it in an unstable stage. | ||
|
|
||
| ## Team asks | ||
|
|
||
| | Team | Support level | Notes | | ||
| | ---------- | ------------- | ------------------------------------------------------------ | | ||
| | [compiler] | Medium | I'd need to find a champion, but I don't know where to start | | ||
|
|
||
| ## Frequently asked questions | ||
|
|
||
| [on-going RFC]: https://github.com/rust-lang/rfcs/pull/3881/ | ||
| [this blog post and talk]: https://blog.goose.love/posts/improving-the-incremental-system-in-the-rust-compiler/ | ||
| [perf-survey]: https://blog.rust-lang.org/2025/09/10/rust-compiler-performance-survey-2025-results/#incremental-rebuilds | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you sketch out a bit more of what you think you can get done in 6 months to a year? The basic goal here, I assume, is that this is largely invisible to users, it's just that things go faster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may also be something best discussed with a champion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I completely went over this section. I'll add a roadmap