# Swap arrayvec crate for heapless to use LenT optimization \(\#47101\) · gitcafe/zed

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

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

Visibility: public

Requested revision: aabc967b1c3217380346c07e4c6b244664ac46e6

Requested commit: aabc967b1c3217380346c07e4c6b244664ac46e6

Commit: aabc967b1c3217380346c07e4c6b244664ac46e6

Tree: 76b944e58d89c0ff48ff4b822742c6bbaf69d6ad

Author: Gnome\!

Committer: GitHub

## Message

```
Swap arrayvec crate for heapless to use LenT optimization (#47101)

Swaps the `arrayvec` dependency for `heapless`, as the `heapless`
library allows changing the type used for the `len` field, which
`arrayvec` hard-codes to `usize`. This means that, for all the
`ArrayVec`s in Zed, we can save 7 bytes on 64 bit platforms by just
storing the length as a `u8`.

I have not benchmarked this change locally, as I don't know what
benchmarking tools are in this project.

As a small bit of context, I wrote the PR to `heapless` to add this
`LenT` generic after seeing a PR on the `arrayvec` crate that seems to
be dead now. Once I saw some of Zed's blog posts about the `rope` crate
and noticed the usage of `arrayvec`, I thought this might be a welcome
change.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
```

## Parents

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

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