# Cache last used layer_id for StackingOrder \(\#4211\) · gitcafe/zed

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

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

Visibility: public

Requested revision: accb4f8756735e74bbfc832490edf81fbad42eee

Requested commit: accb4f8756735e74bbfc832490edf81fbad42eee

Commit: accb4f8756735e74bbfc832490edf81fbad42eee

Tree: 13108d8e572da8a5546c895dea7488bf0523edc4

Author: Thorsten Ball

Committer: GitHub

## Message

```
Cache last used layer_id for StackingOrder (#4211)

This optimizes rendering time by saving computation of the layer_id and
comparison when inserting it into the `BTreeMaps`.


![layer_id_caching](https://github.com/zed-industries/zed/assets/1185253/2944fa3d-586b-4a9a-9dfc-0acf59b77402)

Release Notes:

- Improved rendering performance when a lot of text is being displayed.
```

## Parents

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

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

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