# editor: Reduce amount of sumtree traversals in \`header_and_footer_blocks\` \(\#43709\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8f8a92ccf07f42722808f9df139c97279962d22d

Requested commit: 8f8a92ccf07f42722808f9df139c97279962d22d

Commit: 8f8a92ccf07f42722808f9df139c97279962d22d

Tree: 5bc96a8cfbf554701f5da027d82a5ad11a70e2f3

Author: Lukas Wirth

Committer: GitHub

## Message

```
editor: Reduce amount of sumtree traversals in `header_and_footer_blocks` (#43709)

Introduces new "mapping point cursors" for the different display map
layers allowing one to map multiple points in increasing order more
efficiently than using the one shot operations.

This is used in the `BlockMap::sync` for `header_and_footer_blocks`
which spends a significant time in sumtree traversal due to repeatedly
transforming points between the different layers. This effectively turns
the complexity of those operations from quadratic in the number of
excerpts to linear, as we only go through the respective sumtrees once
instead of restarting from the start over and over again.

Release Notes:

- Improved performance for editors of large multibuffers with many
different files
```

## Parents

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

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