# project: Use VecDeque in SearchHistory \(\#31224\) · gitcafe/zed

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

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

Visibility: public

Requested revision: c50093d68c6d3feb509d614f3aac39d9a7caada8

Requested commit: c50093d68c6d3feb509d614f3aac39d9a7caada8

Commit: c50093d68c6d3feb509d614f3aac39d9a7caada8

Tree: 5bb208301be9230d7375ca8e59bf849b720a2d87

Author: tidely

Committer: GitHub

## Message

```
project: Use VecDeque in SearchHistory (#31224)

`SearchHistory` internally enforced the max length of the search history
by popping elements from the front using `.remove(0)`. For a `Vec` this
is a `O(n)` operation. Use a `VecDeque` to make this `O(1)`

I also made it so the excess element is popped before the new one is
added, which keeps the allocation at the desired size.

Release Notes:

- N/A
```

## Parents

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

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