# agent: Don't track large and common binary files \(\#31352\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 9da9ef860b4ef2e80326a99eacc9b6a221b482ca

Requested commit: 9da9ef860b4ef2e80326a99eacc9b6a221b482ca

Commit: 9da9ef860b4ef2e80326a99eacc9b6a221b482ca

Tree: 022c5a9d93964b92361a07a08c7586501ed9a69e

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
agent: Don't track large and common binary files (#31352)

## Issue

The agent may run very slowly on projects that contain many or large
binary files not listed in `.gitignore`.


## Solution

Temporarily rewrite `.git/info/exludes` to ignore:
- Common binary files based on the extension
- Files larger than 2 MB

## Benchmark

I measure the time between sending an agent message in UI ("hitting
Enter") and actually sending it to an LLM. Ideally, it should be
instant. Numbers for a 7.7 GB Rust project with no .gitignore.

Filter                            | Time
----------------------------------|-----
No filter (= before this change)  | 62 s
Exclude common file types only    | 1.46 s
Exclude files >2MB only           | 1.16 s
Exclude both                      | 0.10 s


## Planned changes:

- [x] Exclude common binary file types
- [x] Exclude large files
- [ ] Track files added by agent so we could delete them (we can't rely
on git for that anymore)
- [ ] Don't block on waiting for a checkpoint to complete until we
really need it
- [ ] Only `git add` files that are about to change


Closes #ISSUE

Release Notes:

- Improved agent latency on repositories containing many files or large
files
```

## Parents

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

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