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

Improve startup time of bash completion. #10365

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

itsjohncs
Copy link
Contributor

cargo list takes about .15 seconds on my computer which is
substantial enough to be the slowest command run when my shell starts
according to sstephenson's bashprof.

This commit defers running cargo list until we need it for the first
time.

Testing

After starting a new shell (which has loaded cargo's bash completion)
type cargo <TAB><TAB> and see the output matches the output prior to
this change (ie: the commands given by cargo list). You should
observe a small delay. You should observe no such delay on subsequent
attempts within the same session.

`cargo list` takes about .15 seconds on my computer which is
substantial enough to be the slowest command run when my shell starts
according to sstephenson's bashprof.

This commit defers running `cargo list` until we need it for the first
time.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 7, 2022
@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Collaborator

bors commented Feb 7, 2022

📌 Commit 7f3f9ed has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2022
@bors
Copy link
Collaborator

bors commented Feb 7, 2022

⌛ Testing commit 7f3f9ed with merge bdb51e7...

@bors
Copy link
Collaborator

bors commented Feb 7, 2022

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing bdb51e7 to master...

@bors bors merged commit bdb51e7 into rust-lang:master Feb 7, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 9, 2022
Update cargo

5 commits in 25fcb135d02ea897ce894b67ae021f48107d522b..c082648646cbb2be266df9ecbcdc253058158d68
2022-02-01 01:32:48 +0000 to 2022-02-08 14:55:05 +0000
- Add rustup link (rust-lang/cargo#10371)
- Improve startup time of bash completion. (rust-lang/cargo#10365)
- Stabilize `-Ztimings` as `--timings` (rust-lang/cargo#10245)
- Remove needless borrow (rust-lang/cargo#10360)
- Compute non custom build and non transitive deps for doc (rust-lang/cargo#10341)
@ehuss ehuss added this to the 1.60.0 milestone Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants