Open RemcoSmitsDev opened 6 days ago
Interesting, I somehow cannot repro this on Zed
project (testing with cargo run --profile release-fast
which is important to do, as debug
might show something totally odd).
But I have created a branch with the "fix", if you want to test it on your case: https://github.com/zed-industries/zed/pull/20470
Hey @SomeoneToIgnore, thanks for looking into this. I will try to reproduce it again with the latest main and see if its fixed now.
So the change/fix that you made seem to do something, because it does not pop up anymore inside the profile as a slow task what is nice! But it does not yet fix the freeze/hangs when scrolling or event just typing inside the search bar while the results are streaming.
I profiled your change/fix on nightly and a dev profile build with cargo run --profile release-fast
.
It contains profile for project search scrolling and toggling the assistant panel
ProjectSearchHangAfterChange.trace.zip
I also added a profile for toggling the assistant panel, while having a lot of project search results open (10K). Because one of the things I noticed that the wrap_map
seem to be slow. But the profile for this does say something else, pre-painting seem to be the task that takes most of the time.
https://github.com/user-attachments/assets/9c0722ff-9440-4cbc-ab52-b0c0527b7a0f
Terminal Log:
[2024-11-10T12:31:45+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:31:46+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:31:46+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:31:46+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:31:46+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:31:46+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:31:54+01:00 ERROR editor] multiple different run targets found on a single line, only the last target will be rendered
[2024-11-10T12:31:56+01:00 ERROR editor] multiple different run targets found on a single line, only the last target will be rendered
[2024-11-10T12:33:25+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:33:26+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:33:26+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:33:26+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:33:26+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:33:26+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:33:31+01:00 ERROR editor] multiple different run targets found on a single line, only the last target will be rendered
[2024-11-10T12:33:33+01:00 ERROR editor] multiple different run targets found on a single line, only the last target will be rendered
[2024-11-10T12:35:11+01:00 ERROR lsp] Cancelled LSP request task for "textDocument/documentHighlight" id 3 which took over 120s
[2024-11-10T12:35:12+01:00 ERROR editor] LSP request timeout
[2024-11-10T12:35:30+01:00 ERROR lsp] Cancelled LSP request task for "textDocument/codeAction" id 45 which took over 120s
[2024-11-10T12:35:30+01:00 ERROR project] LSP request timeout
[2024-11-10T12:40:53+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:05+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR lsp] oneshot canceled
[2024-11-10T12:41:13+01:00 ERROR assistant] entity release
[2024-11-10T12:41:31+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:32+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:32+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:32+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:32+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:32+01:00 ERROR project] stream did not contain valid UTF-8
[2024-11-10T12:41:37+01:00 ERROR editor] multiple different run targets found on a single line, only the last target will be rendered
[2024-11-10T12:41:39+01:00 ERROR editor] multiple different run targets found on a single line, only the last target will be rendered
[2024-11-10T12:43:35+01:00 ERROR lsp] Cancelled LSP request task for "textDocument/codeAction" id 84 which took over 120s
[2024-11-10T12:43:35+01:00 ERROR project] LSP request timeout
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
[2024-11-10T13:10:20+01:00 ERROR lsp] oneshot canceled
Sorry, still have nothing like that on my profiles of test
search in Zed (maybe due to a different machine).
But *_map/layouting is bad news then, as itself it's most probably not the thing we can improve and only take a step back and understand what is being done wrong.
I have no good clues now though.
If you want to pair on this to find out what is taking so much time, let me know happy to help!
that happens to me regardless wether the results are streaming or not, and i don’t even have the assistant panel enabled
Thank you for the proposal, @RemcoSmitsDev I think I'm not the best person to do this and will waste a lot of time for nothing (I'd pick @\osiewicz instead for such a vague search) + have a bunch of other things to deal with that seem to be a bit more important in the next few months (git, LiveKit on Linux).
So, maybe let's do it next year if you won't find anyone by then 🙂
Another thing that might be very related and I've missed, are the actual files you're getting: Zed overly tries to start LSP servers for all open excerpts and that is not what we should do.
Check for existing issues
Describe the bug / provide steps to reproduce it
Issue
There's a performance issue when searching through a large number of results (approximately 10,000). After pressing 'Enter' to initiate the search, scrolling becomes significantly delayed while results are still streaming in. This regression appears to be caused by the continuous refreshing of runnables.
Reproduce steps:
You should experience noticeable lag or hanging during the scrolling process, similar to the original issue described.
https://github.com/user-attachments/files/17683266/ProjectSearchHang.trace.zip
Environment
Zed: v0.162.0 (Zed Nightly 706c385c24f7cda1b997fd790e744320dbe20186) OS: macOS 15.1.0 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
https://github.com/user-attachments/assets/cd27b44d-b5fd-448e-b045-d49c2e871555
If applicable, attach your Zed.log file to this issue.
Zed.log
``` ```