-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Read incremental files on-demand #83036
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 3c25ddf with merge 833254a567948c75829d14b281da174002a6cfd5... |
☀️ Try build successful - checks-actions |
Queued 833254a567948c75829d14b281da174002a6cfd5 with parent b3e19a2, future comparison URL. |
Finished benchmarking try commit (833254a567948c75829d14b281da174002a6cfd5): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
6672a4e
to
296ca4c
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 296ca4c with merge 4937463fe51189b570f25fbd1d948a163a1e89c9... |
☀️ Try build successful - checks-actions |
Queued 4937463fe51189b570f25fbd1d948a163a1e89c9 with parent f293f70, future comparison URL. |
Finished benchmarking try commit (4937463fe51189b570f25fbd1d948a163a1e89c9): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
This does substantially reduce memory usage for incremental builds, but increases compile times. This doesn't seem like it inherently needs to be slower. I'm wondering if using the ReadBuf-based interfaces might help here, to avoid repeatedly having to initialize buffers and use |
I'm also wondering if it'd be possible to use |
Could mmap be used here? Maybe with |
I switched the metadata reading in cg_clif from |
Also |
Closing in favour of #83214 |
Simplify encoder and decoder Extracted from rust-lang#83036 and rust-lang#82780.
Mmap the incremental data instead of reading it. Instead of reading the full incremental state using `fs::read_file`, we memmap it using a private read-only file-backed map. This allows the system to reclaim any memory we are not using, while ensuring we are not polluted by outside modifications to the file. Suggested in rust-lang#83036 (comment) by `@bjorn3`
This should avoid a short-lived memory spike at the beginning of the compilation.