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 ...
876ec5a8a0Lukas Wirth committed on 5/31/2026, 3:19:20 PM· committed by GitHubparentfd93a53
3 files changedLine totals unavailable