# Improve performance of \`create_highlight_endpoints\` \(\#58119\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 876ec5a8a074ba83cce2129ed4d76b59c05a37e9

Requested commit: 876ec5a8a074ba83cce2129ed4d76b59c05a37e9

Commit: 876ec5a8a074ba83cce2129ed4d76b59c05a37e9

Tree: 0d51a71c4b963b8cad76fbabdde4d14c2a9b2def

Author: Lukas Wirth

Committer: GitHub

## Message

```
Improve performance of `create_highlight_endpoints` (#58119)

This change gets rid of the tree traversal overhead by batching the
anchor resolution

> Create highlight endpoints/text_highlights/100
>                         time:   [298.43 µs 298.55 µs 298.69 µs]

> Create highlight endpoints/text_highlights/100
>                         time:   [40.347 µs 40.386 µs 40.427 µs]
> change: [-86.492% -86.481% -86.471%] (p = 0.00 < 0.05)
>                         Performance has improved.

This is especially important given that `CustomHighlightsChunks::seek`
tends to get called a lot, which re-creates highlight endpoints a lot.

Release Notes:

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

## Parents

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

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