Skip to content

feat: improve CPU usage #10088

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

Merged
merged 4 commits into from
Aug 30, 2021
Merged

feat: improve CPU usage #10088

merged 4 commits into from
Aug 30, 2021

Conversation

matklad
Copy link
Member

@matklad matklad commented Aug 30, 2021

No description provided.

It doesn't make sense for the prime_caches itself send begin/end events
-- the caller knows perfectly fine when they happen!
Let's have only one place where we start delayed ops
There should be only one place where we need to check if we want to
start background activities.
@bjorn3
Copy link
Member

bjorn3 commented Aug 30, 2021

I think you mentioned the wrong issue in the last commit.

@matklad
Copy link
Member Author

matklad commented Aug 30, 2021

Seems to work!

It even has this fun effect that, after typing, the indexing restarts at the crate it was finished at -- that's because the coalescing code just rushes thorough already analyzed crates.

I wonder if we can add "is this fresh?" query to salsa, so that we can actually implement this, instead of relying on timing?

bors r+

cc @jonas-schievink

@matklad
Copy link
Member Author

matklad commented Aug 30, 2021

bors r-

@bors
Copy link
Contributor

bors bot commented Aug 30, 2021

Canceled.

closes rust-lang#9922

Turned out to be trivial after preliminary refactor.

The intended behavior is that we schedule cache priming once ws become
quiescent (that is, we fully load cargo project), and we continue to
rschedule it until it completes (priming might get cancelled by user
typing into a file).
@matklad
Copy link
Member Author

matklad commented Aug 30, 2021

I think you mentioned the wrong issue in the last commit.

Oups, how could I, that was almost #9292!

bors r+

@matklad
Copy link
Member Author

matklad commented Aug 30, 2021

I've just realized that bors implements exactly the same concurrency control as we do -- pushes to a branch cancel pending runs, and my git push --force-with-lease && gh pr comment --body 'bors r+' is exactly if cancelled { self.prime_caches_queue.request_op(); } 🤣

@bors
Copy link
Contributor

bors bot commented Aug 30, 2021

@bors bors bot merged commit 5c704f1 into rust-lang:master Aug 30, 2021
@matklad matklad deleted the cp branch August 30, 2021 16:57
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.

2 participants