Skip to content
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

Stream unpacking of source distribution downloads #1157

Merged
merged 3 commits into from
Jan 29, 2024

Conversation

charliermarsh
Copy link
Member

This PR migrates our source distribution downloads to unzip as we stream, similar to our approach for wheels.

In my testing, this showed a consistent speedup (e.g., 6% here for a few representative source distributions):

❯ python -m scripts.bench --puffin-path ./target/release/main --puffin-path ./target/release/puffin --benchmark install-cold requirements.in
Benchmark 1: ./target/release/main (install-cold)
  Time (mean ± σ):      1.503 s ±  0.039 s    [User: 1.479 s, System: 0.537 s]
  Range (min … max):    1.466 s …  1.605 s    10 runs

Benchmark 2: ./target/release/puffin (install-cold)
  Time (mean ± σ):      1.421 s ±  0.024 s    [User: 1.505 s, System: 0.593 s]
  Range (min … max):    1.381 s …  1.454 s    10 runs

Summary
  './target/release/puffin (install-cold)' ran
    1.06 ± 0.03 times faster than './target/release/main (install-cold)'

@charliermarsh charliermarsh added the performance Potential performance improvement label Jan 29, 2024
@charliermarsh charliermarsh merged commit d88ce76 into main Jan 29, 2024
5 checks passed
@charliermarsh charliermarsh deleted the charlie/async-zip branch January 29, 2024 01:09
@@ -19,6 +19,9 @@ license = "MIT OR Apache-2.0"
[workspace.dependencies]
anstream = { version = "0.6.5" }
anyhow = { version = "1.0.79" }
async-compression = { version = "0.4.6" }
async-std = {version = "1.6.0" }
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit worried about the async-std dep, it's abandoned and could clash with tokio(?)

Copy link
Member Author

Choose a reason for hiding this comment

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

What is your source for async-std being abandoned?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can migrate to https://crates.io/crates/tokio-tar which is a fork for Tokio. Or I can look into forking async-tar to land this PR: dignifiedquire/async-tar#41.

Copy link
Member

Choose a reason for hiding this comment

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

There is no official message or anything, there's just barely any activity on the repo anymore

image

image

As long as it's stable it's fine, i'm more worried we'll get some clash with tokio or something because they are different executors with different runtimes and types.

charliermarsh added a commit that referenced this pull request Jan 29, 2024
## Summary

`tokio_tar` is a fork of `async_tar` that uses Tokio instead of
`async-std`. Using it removes a significant dependency from our tree.

(There is an open PR
(dignifiedquire/async-tar#41) in `async-tar` to
add Tokio support, but it's over a year old.)

See:
#1157 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants