# git_ui: Avoid blocking main thread during stage/unstage \(\#47806\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0c9b8fdba801baef3e0ed8f25b75958b33d545dc)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0c9b8fdba801baef3e0ed8f25b75958b33d545dc

Requested commit: 0c9b8fdba801baef3e0ed8f25b75958b33d545dc

Commit: 0c9b8fdba801baef3e0ed8f25b75958b33d545dc

Tree: 941f8c13ccfe4222352719dfe1de6a1ed2dc04c7

Author: Marco Mihai Condrache

Committer: GitHub

## Message

```
git_ui: Avoid blocking main thread during stage/unstage (#47806)

With a large number of files in the git status, pressing stage/unstage
could cause a noticeable freeze. The async performance profiler showed
that the task spawned inside `change_all_files_stage` blocked the main
thread for 300ms+, resulting in a clear and visible UI stall. The main
cause was the need to traverse all entries to determine what to stage or
unstage, which becomes expensive for large change sets.

Same repro as: #47800

Release Notes:

- Improved latency of stage/unstage operations
```

## Parents

- [e6939ad05c160b9757860cdccf06911d80b78a24](https://git.cafe/gitcafe/zed/commit/e6939ad05c160b9757860cdccf06911d80b78a24?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0c9b8fdba801baef3e0ed8f25b75958b33d545dc?format=markdown)
