Skip to content

Reduce display_map snapshot creation - #39354

Merged
nia-e merged 16 commits into
zed-industries:mainfrom
RemcoSmitsDev:reduce-display-snapshot-creation
Oct 17, 2025
Merged

Reduce display_map snapshot creation#39354
nia-e merged 16 commits into
zed-industries:mainfrom
RemcoSmitsDev:reduce-display-snapshot-creation

Conversation

@RemcoSmitsDev

@RemcoSmitsDev RemcoSmitsDev commented Oct 2, 2025

Copy link
Copy Markdown
Collaborator

Re-applies #30840

This PR re-applies the initial PR. As it was closed because it was hard to land, because of the many conflicts. This PR re-applies the changes for it.

I discovered that in several cases we were creating multiple display_map snapshots within the same root-level function call. I noticed that creating a display_map snapshot is quite slow, and found that in some cases we were creating the snapshot multiple times.

cc @ConradIrwin As you reviewed my previous PR.

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Oct 2, 2025
@ConradIrwin

Copy link
Copy Markdown
Member

@nia-e would you be able to run your perf script on this change? I'm curious how much of a difference it makes.

osiewicz added a commit that referenced this pull request Oct 9, 2025
This takes the idea that @RemcoSmitsDev started on in
#39354. We did away with
grabbing a snapshot of the display map when buffer coordinates were
sufficient.
Closes #37267

Release Notes:

- Reduced micro-stutters in project search with large multi-buffer
contents.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
@nia-e

nia-e commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Slapped #[perf] on the tests in the search crate and it seems positive :> This is compared to the head commit of the PR:

Category Max Mean Min
average ↑± 0.7% ↓± 1.0% ↓ 5.4%

I'll take the 0.7% as just noise, but clearly this speeds some stuff up so it's worth merging imo

@RemcoSmitsDev

RemcoSmitsDev commented Oct 17, 2025

Copy link
Copy Markdown
Collaborator Author

That's great to hear, I will merge main in again tonight, then. Thanks for profiling!

@RemcoSmitsDev
RemcoSmitsDev force-pushed the reduce-display-snapshot-creation branch from caaaa05 to eb34d52 Compare October 17, 2025 15:05
@RemcoSmitsDev
RemcoSmitsDev force-pushed the reduce-display-snapshot-creation branch from eb34d52 to 0eec61f Compare October 17, 2025 15:41
@nia-e

nia-e commented Oct 17, 2025

Copy link
Copy Markdown
Contributor

LGTM. Thanks for the PR ^^

@nia-e
nia-e merged commit 7e97fca into zed-industries:main Oct 17, 2025
22 checks passed
@RemcoSmitsDev
RemcoSmitsDev deleted the reduce-display-snapshot-creation branch October 19, 2025 15:50
jasonsmithio pushed a commit to paddleboarddev/paddleboard that referenced this pull request May 31, 2026
This takes the idea that @RemcoSmitsDev started on in
zed-industries/zed#39354. We did away with
grabbing a snapshot of the display map when buffer coordinates were
sufficient.
Closes #37267

Release Notes:

- Reduced micro-stutters in project search with large multi-buffer
contents.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Re-applies zed-industries#30840

This PR re-applies the initial
[PR](zed-industries#30840). As it was closed
because it was hard to land, because of the many conflicts. This PR
re-applies the changes for it.

In several cases we were creating multiple display_map
snapshots within the same root-level function call.
Creating a display_map snapshot is quite slow, and in some
cases we were creating the snapshot multiple times.

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants