Skip to content

perf(config): avoid full manifest parsing for release hints - #5214

Open
reidliu41 wants to merge 2 commits into
rust-lang:mainfrom
reidliu41:perf/release-hint-manifest-header
Open

reidliu41 wants to merge 2 commits into
rust-lang:mainfrom
reidliu41:perf/release-hint-manifest-header

Conversation

@reidliu41

@reidliu41 reidliu41 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Each release-hint check currently reads and parses the whole
multirust-channel-manifest.toml, which is around 33,000 lines and
1 MiB, just to get its date.

Read only the beginning of the manifest and parse the root date. If that
does not work, fall back to the existing full manifest loader.

On my machine:

The numbers below are averages across multiple runs using a 971,571-byte manifest with 32,938 lines:

Command Before, hints on After, hints on Before, hints off After, hints off Improvement
rustup toolchain list 13.56 ms 8.28 ms 8.19 ms 8.11 ms 38.9%
rustup which rustc 14.13 ms 7.96 ms 8.35 ms 7.93 ms 43.7%
rustup override list 13.99 ms 8.20 ms 8.41 ms 7.91 ms 41.4%
rustup completions bash 14.26 ms 8.90 ms 8.34 ms 8.83 ms 37.6%
rustup show 20.12 ms 14.46 ms 13.69 ms 13.77 ms 28.1%

With release hints enabled, the tested commands are 28–44% faster.
The updated timings are close to the release-hints-disabled baseline.

@rami3l rami3l self-assigned this Nov 13, 2026
@rami3l
rami3l self-requested a review November 13, 2026 17:03
@rami3l

rami3l commented Nov 13, 2026

Copy link
Copy Markdown
Member

@reidliu41 Thanks for the patch! Let me take some time to check whether this is the best way forward.

When adding the feature in #4869 I was already worrying about the performance implications.

@rami3l

rami3l commented Nov 13, 2026

Copy link
Copy Markdown
Member

@reidliu41 Technically this looks like a solid approach. Thanks! I'll find some time to give more detailed review comments.

Now that we are at it, would you mind doing the same bench again with the release hints turned off? I'm afraid your table above is not giving the full picture.

Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs Resolved
@reidliu41

Copy link
Copy Markdown
Contributor Author

@reidliu41 Technically this looks like a solid approach. Thanks! I'll find some time to give more detailed review comments.

Now that we are at it, would you mind doing the same bench again with the release hints turned off? I'm afraid your table above is not giving the full picture.

Updated the description after applying the suggested changes.

Comment thread src/dist/manifestation/tests.rs Outdated
let manifest = Manifest::parse(include_str!(
"../manifest/tests/channel-rust-nightly-example.toml"
))?;
let expected_date = manifest.date.clone();

@rami3l rami3l Nov 14, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: It looks like this .clone() is redundant since it is immediately used for equality comparison later? How about just comparing the referenced values?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Manifest::stringify() currently consumes self, so borrowing
manifest.date across that call would not compile. The test now stringifies
the parsed manifest directly and compares the date read from the serialized
output against the fixture's known date, avoiding the clone.

Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation.rs
let prefix = self.installation.prefix();
if let Some(manifest_path) = prefix.dist_manifest() {
let date = fs::File::open(&manifest_path)
.map_err(anyhow::Error::from)

@rami3l rami3l Nov 14, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: This .map_err() looks redundant because it is immediately consumed by debug!() afterwards?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The conversion is required by and_then: File::open() returns
std::io::Error, while read_manifest_date() returns anyhow::Error.
Removing it fails to compile because and_then requires the same error
type on both sides. Keeping the errors separate would require nested
matches and duplicate the fallback logging, so the current form seems
a little simpler.

Comment thread src/dist/manifestation.rs Resolved
Comment thread src/dist/manifestation/tests.rs Resolved

@rami3l rami3l left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot for the quick reply! I believe we are very close to the finish line :)

View changes since this review

@reidliu41
reidliu41 force-pushed the perf/release-hint-manifest-header branch from 42b8a6d to 57206ec Compare November 14, 2026 14:37
@reidliu41
reidliu41 force-pushed the perf/release-hint-manifest-header branch from 57206ec to a0586b0 Compare November 14, 2026 14:59

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants