Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/dist/component/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::mem;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;
use std::time::{Duration, Instant};

use anyhow::{Context, Result, anyhow, bail};
use tar::EntryType;
Expand Down Expand Up @@ -108,7 +109,15 @@ impl<P: Deref<Target = Path>> DirectoryPackage<P> {
let manifest = utils::read_file("package manifest", &root.join("manifest.in"))?;
let mut builder = target.add(name, tx);

let yield_timeout = Duration::from_millis(50);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is pretty short -- have you tried with longer intervals, like 250/500/1000ms?

Copy link
Member Author

Choose a reason for hiding this comment

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

No significant changes on my side with either of those values: the installation is always ~2x slower than latest.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, that seems very surprising.

let mut last_yield = Instant::now();
for l in manifest.lines() {
if Instant::now().duration_since(last_yield) > yield_timeout {
// Yield to the async runtime to keep things moving
tokio::task::yield_now().await;
last_yield = Instant::now();
}

let part = ComponentPart::decode(l)
.ok_or_else(|| RustupError::CorruptComponent(name.to_owned()))?;

Expand Down
Loading