Skip to content

load files for the command palette async so it opens faster#10332

Merged
acarl005 merged 2 commits into
masterfrom
andy/async-load-cmd-palette-files
May 7, 2026
Merged

load files for the command palette async so it opens faster#10332
acarl005 merged 2 commits into
masterfrom
andy/async-load-cmd-palette-files

Conversation

@acarl005
Copy link
Copy Markdown
Contributor

@acarl005 acarl005 commented May 7, 2026

Description

This PR refactors the FileDataSource to load the files asynchronously. This avoids blocking the main thread and solves the momentary pause when opening the command palette.

Linked Issue

Fixes #10256

Testing

No perceived changes in local testing. On slower machines, the results may not actually appear for a couple of seconds while the data source is still computing the results.

I sent the user a custom built from this branch and they have confirmed it solves the issue

#10256 (comment)

Changelog Entries for Stable

CHANGELOG-IMPROVEMENT: Performance improvement for opening the command palette when in a project with a lot of files.

@cla-bot cla-bot Bot added the cla-signed label May 7, 2026
@acarl005 acarl005 marked this pull request as ready for review May 7, 2026 18:06
@acarl005 acarl005 requested a review from kevinchevalier May 7, 2026 18:06
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 7, 2026

@acarl005

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR moves zero-state command palette file result construction into an async future and yields while iterating so long file lists can be aborted more responsively. The security pass found no security-specific findings.

Concerns

  • The expensive repo snapshot still happens synchronously before the async future is spawned, so opening the palette can still block on repo-content cache population or git status in the slow cases this PR targets.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@@ -127,47 +127,54 @@ impl FileDataSource {

let (contents, git_changed_files) = self.contents_with_git_changes(app);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] contents_with_git_changes(app) still runs synchronously before the future is spawned, including repo-content cache population and git status; move that snapshot work off the palette-open path so large repos do not still block before yielding.

Copy link
Copy Markdown
Contributor

@kevinchevalier kevinchevalier left a comment

Choose a reason for hiding this comment

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

I'm approving since it fixed the issue for the user, but it's unclear to me which part of this is fixing the issue. Which part was slow before?

It seems like computing the contents is still sync, and then the other work were just a couple of hashmap lookups.

Is it the sort?

@acarl005
Copy link
Copy Markdown
Contributor Author

acarl005 commented May 7, 2026

I suspect it's the heap allocations happening inside the for-loop. There could be 100's of thousands if not millions of files.

@acarl005 acarl005 merged commit 564c70e into master May 7, 2026
41 checks passed
@acarl005 acarl005 deleted the andy/async-load-cmd-palette-files branch May 7, 2026 20:09
trungtai1805 pushed a commit to trungtai1805/warp that referenced this pull request May 9, 2026
zhangyu1818-bot pushed a commit to zhangyu1818/warply that referenced this pull request May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Palette opens slowly in large projects before any query is typed

2 participants