# multi_buffer: Speed up \`Anchor::to_offset\` resolution \(\#48021\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 9b3777a14e885df6b164151d1e0fed0f84568803

Requested commit: 9b3777a14e885df6b164151d1e0fed0f84568803

Commit: 9b3777a14e885df6b164151d1e0fed0f84568803

Tree: 5f299c05e3f2974edf7d32dd3bb41dbde6539b69

Author: Lukas Wirth

Committer: GitHub

## Message

```
multi_buffer: Speed up `Anchor::to_offset` resolution (#48021)

We used to just use the anchor resolution function that allows resolving
multiple anchors in one loop before. That has a lot of overhead though
when we only have a single anchor to resolve, so instead we just
specialize that case now as resolving a single anchor to an offset is a
super common operation.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
```

## Parents

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

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