Skip to content

worktree: Improve performance with large # of repositories #35052

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 10 commits into from
Jul 25, 2025

Conversation

osiewicz
Copy link
Contributor

@osiewicz osiewicz commented Jul 24, 2025

In this PR we've reworked how git status updates are processed. Most notable change is moving the processing into a background thread (and splitting it across multiple background workers). We believe it is safe to do so, as worktree events are not deterministic (fs updates are not guaranteed to come in any order etc), so I've figured that git store should not be overly order-reliant anyways.

Note that this PR does not solve perf issues wholesale - other parts of the system are still slow to process stuff (which I plan to nuke soon).

Related to #34302

Release Notes:

  • Improved Zed's performance in projects with large # of repositories

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jul 24, 2025
@osiewicz osiewicz requested a review from cole-miller July 24, 2025 19:15
@osiewicz osiewicz marked this pull request as ready for review July 24, 2025 19:26
@osiewicz
Copy link
Contributor Author

@cole-miller I've applied your feedback from #34460 (comment) with a small twist; we're not gonna walk preceding paths, as that exposes us to a potential O(n) behavior we're trying to avoid in the first place. Instead, we'll retry with a parent as a query. That way, we basically optimize against cases where there are multiple projects with a repository in a single parent - because we'll just skip over all siblings at the cost of doing one range search per parent. This should also terminate somewhat reliably, because we're bailing from this function if .last ever fails.

@osiewicz
Copy link
Contributor Author

osiewicz commented Jul 25, 2025

Gonna merge this optimistically. Give a shout if you feel like anything should be changed, Cole.

@osiewicz osiewicz merged commit 631f9a1 into main Jul 25, 2025
21 checks passed
@osiewicz osiewicz deleted the worktree-perf-lots-of-git-repos branch July 25, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant