zed icon indicating copy to clipboard operation
zed copied to clipboard

The outline view causes poor selection performance on linux

Open mhanuszh opened this issue 1 year ago • 4 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Dragging the cursor while mouse-1 is pressed (usual selection) is very slow

vkcube works and detects my GPU:

mh red001 ~ $ vkcube
Selected GPU 0: NVIDIA GeForce GTX 1050 Ti, type: DiscreteGpu

~~The same thing happens if the outline is hidden~~

Environment

Zed: v0.143.6 (Zed) OS: Linux X11 debian 12 Memory: 15.6 GiB Architecture: x86_64

Debian 12, Gnome 43.9, X11, Nvidia 535.183.01, Kernel 6.1.0-17-amd64 i5-2500, 16GB DDR3, GTX 1050 Ti

If applicable, add mockups / screenshots to help explain present your vision of the feature

I did not release the mouse-1 until the very end.

https://github.com/zed-industries/zed/assets/5262962/eaf8e4b2-8f6b-48eb-9004-9da9b484f7f8

If applicable, attach your Zed.log file to this issue.

Zed.log

2024-07-11T20:02:50+02:00 [INFO] ========== starting zed ==========
2024-07-11T20:02:50+02:00 [INFO] Compositor detection: _NET_WM_CM_S?=false, _NET_WM_CM_OWNER=false, _NET_SUPPORTING_WM_CHECK=true
2024-07-11T20:02:50+02:00 [INFO] x11: compositor present: true, gtk_frame_extents_supported: true
2024-07-11T20:02:50+02:00 [INFO] Try connect ibus
2024-07-11T20:02:50+02:00 [INFO] Opening main db
2024-07-11T20:02:50+02:00 [INFO] perform;
2024-07-11T20:02:50+02:00 [INFO] read_command;
2024-07-11T20:02:50+02:00 [INFO] read_command;
2024-07-11T20:02:50+02:00 [INFO] socket reader;
2024-07-11T20:02:50+02:00 [INFO] new;
2024-07-11T20:02:50+02:00 [INFO] keep_updated;
2024-07-11T20:02:50+02:00 [INFO] Using git binary path: None
2024-07-11T20:02:50+02:00 [INFO] extensions updated. loading 1, reloading 0, unloading 0
2024-07-11T20:02:50+02:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-07-11T20:02:50+02:00 [INFO] set environment variables from shell:/bin/bash, path:/home/mh/.local/bin:/home/mh/.cargo/bin:/home/mh/.bun/bin:/home/mh/.deno/bin:/home/mh/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
2024-07-11T20:02:50+02:00 [INFO] XConnected server on 27263028, transport version: 0.0, TRANSPORT_MAX: 20
2024-07-11T20:02:50+02:00 [INFO] perform;
2024-07-11T20:02:50+02:00 [INFO] read_command;
2024-07-11T20:02:50+02:00 [INFO] Opening main db
2024-07-11T20:02:50+02:00 [INFO] read_command;
2024-07-11T20:02:50+02:00 [INFO] socket reader;
2024-07-11T20:02:50+02:00 [INFO] Using Visual { id: 35, colormap: 0, depth: 32 }
2024-07-11T20:02:50+02:00 [INFO] Creating colormap 6291459
2024-07-11T20:02:51+02:00 [INFO] Enabling Vulkan Portability
2024-07-11T20:02:51+02:00 [INFO] Adapter "NVIDIA GeForce GTX 1050 Ti"
2024-07-11T20:02:51+02:00 [INFO] No ray tracing extensions are supported
2024-07-11T20:02:51+02:00 [INFO] Using surface present mode FIFO_RELAXED
2024-07-11T20:02:51+02:00 [WARN] Unable to forbid exclusive full screen
2024-07-11T20:02:51+02:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-07-11T20:02:51+02:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-07-11T20:02:51+02:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored }
2024-07-11T20:02:51+02:00 [INFO] Refreshing at 16666 micros
2024-07-11T20:02:51+02:00 [WARN] GPU frame is out of date
2024-07-11T20:02:51+02:00 [INFO] Using surface present mode FIFO_RELAXED
2024-07-11T20:02:51+02:00 [WARN] Unable to forbid exclusive full screen
2024-07-11T20:02:51+02:00 [INFO] Opening main db
2024-07-11T20:02:51+02:00 [ERROR] No path stored for this editor
2024-07-11T20:02:51+02:00 [WARN] GPU frame is out of date
2024-07-11T20:02:51+02:00 [INFO] Using surface present mode FIFO_RELAXED
2024-07-11T20:02:51+02:00 [WARN] Unable to forbid exclusive full screen
2024-07-11T20:02:51+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 46, input_context_id: 345 }
2024-07-11T20:02:57+02:00 [INFO] Initializing default prettier with plugins {}
2024-07-11T20:03:23+02:00 [WARN] Unknown request DestroyIcReply { input_method_id: 46, input_context_id: 347 }
2024-07-11T20:03:25+02:00 [ERROR] window not found
2024-07-11T20:03:25+02:00 [ERROR] window not found

mhanuszh avatar Jul 11 '24 18:07 mhanuszh

Please disregard my statement about the outline panel.

When starting Zed with the outline already hidden, the performance is much better. After the outline is opened, the degraded performance reappears. From this state, hiding the outline wont fix the problem.

mhanuszh avatar Jul 13 '24 01:07 mhanuszh

Seems to be Linux-specific indeed, as macOS seems to be fine in the same example:

https://github.com/user-attachments/assets/a913e48f-f9c7-49cc-bbc8-8bbeeb1cfd89

This does not necessarily mean that the code is good and doing the right thing though, I believe there's a room for optimizations there too, the entry point is https://github.com/zed-industries/zed/blob/59ce3535d38946acaa7f7dcf6fcdf0aedd127432/crates/outline_panel/src/outline_panel.rs#L3023-L3026

But nonetheless, it would be interesting to know what is different in the Linux part.

SomeoneToIgnore avatar Jul 13 '24 19:07 SomeoneToIgnore

This sounds more like https://github.com/zed-industries/zed/issues/16213 (i.e. mice with high polling rate on X11) rather than an issue with the outline panel itself.

From this state, hiding the outline wont fix the problem.

apricotbucket28 avatar Aug 21 '24 20:08 apricotbucket28

Good point about X11.

https://github.com/zed-industries/zed/pull/16512 had improved the situation around revealing by adding a timeout + now all revealing/refreshing/other-task-related things are not done when the panel is not shown.

Could you recheck and see if anything had improved for you? If not, I'd also start leaning closer to X11 theory.

SomeoneToIgnore avatar Aug 25 '24 22:08 SomeoneToIgnore

Good point about X11.

#16512 had improved the situation around revealing by adding a timeout + now all revealing/refreshing/other-task-related things are not done when the panel is not shown.

Could you recheck and see if anything had improved for you? If not, I'd also start leaning closer to X11 theory.

Since then I have reinstalled my system, but the issue is still present, on wayland too

Zed 0.149.6 Fedora 40, GNOME 46.4, Wayland, Nvidia 555.58.02, Kernel 6.10.4-200.fc40.x86_64

mhanuszh avatar Aug 27 '24 18:08 mhanuszh

There were more optimizations since the last time I've asked to recheck this, so I'd appreciate another check.

SomeoneToIgnore avatar Sep 29 '24 20:09 SomeoneToIgnore

:cry:

https://github.com/user-attachments/assets/2e19073d-cf3b-4db6-9293-85ca60cf3c8a

Zed: v0.154.3 (Zed) OS: Linux Wayland fedora 40 Memory: 15.6 GiB Architecture: x86_64 GPU: NVIDIA GeForce GTX 1050 Ti || NVIDIA || 555.58.02

Log

2024-09-29T23:26:31.192402031+02:00 [INFO] ========== starting zed ========== 2024-09-29T23:26:31.223499667+02:00 [INFO] perform; 2024-09-29T23:26:31.223600524+02:00 [INFO] authenticate; 2024-09-29T23:26:31.223693736+02:00 [INFO] Opening main db 2024-09-29T23:26:31.223821927+02:00 [INFO] read_command; 2024-09-29T23:26:31.224928203+02:00 [INFO] Opening main db 2024-09-29T23:26:31.225123757+02:00 [INFO] new; 2024-09-29T23:26:31.225281574+02:00 [INFO] socket reader; 2024-09-29T23:26:31.22625865+02:00 [INFO] keep_updated; 2024-09-29T23:26:31.226745643+02:00 [INFO] Using git binary path: None 2024-09-29T23:26:31.273505495+02:00 [ERROR] No such file or directory (os error 2) about ["/home/mh/.config/github-copilot"] 2024-09-29T23:26:31.273661551+02:00 [INFO] initializing context server client 2024-09-29T23:26:31.273828242+02:00 [INFO] Registering built-in prompt template: content_prompt 2024-09-29T23:26:31.274302777+02:00 [INFO] Registering built-in prompt template: edit_workflow 2024-09-29T23:26:31.274690131+02:00 [INFO] Registering built-in prompt template: step_resolution 2024-09-29T23:26:31.275344642+02:00 [INFO] Registering built-in prompt template: terminal_assistant_prompt 2024-09-29T23:26:31.275673563+02:00 [INFO] No prompt template overrides directory found at /home/mh/.local/share/zed/prompt_overrides. Using built-in prompts. 2024-09-29T23:26:31.276098694+02:00 [INFO] extensions updated. loading 1, reloading 0, unloading 0 2024-09-29T23:26:31.282913657+02:00 [INFO] set environment variables from shell:/bin/bash, path:/home/mh/.deno/bin:/home/mh/.deno/bin:/home/mh/.deno/bin:/home/mh/.local/bin:/home/mh/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin 2024-09-29T23:26:31.288280079+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.288497977+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.288588979+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.28866328+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.288767637+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.289864258+02:00 [INFO] activate is not implemented on Linux, ignoring the call 2024-09-29T23:26:31.290046146+02:00 [INFO] Opening main db 2024-09-29T23:26:31.293103823+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.293210994+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.293280445+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.293349375+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.295143133+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.295713905+02:00 [INFO] perform; 2024-09-29T23:26:31.295794371+02:00 [INFO] authenticate; 2024-09-29T23:26:31.295873016+02:00 [INFO] read_command; 2024-09-29T23:26:31.299097613+02:00 [INFO] socket reader; 2024-09-29T23:26:31.362886767+02:00 [INFO] Enabling Vulkan Portability 2024-09-29T23:26:31.36297265+02:00 [INFO] Enabling color space support 2024-09-29T23:26:31.413518328+02:00 [INFO] Adapter: "NVIDIA GeForce GTX 1050 Ti" 2024-09-29T23:26:31.413676536+02:00 [INFO] No ray tracing extensions are supported 2024-09-29T23:26:31.447295168+02:00 [INFO] Using surface present mode MAILBOX 2024-09-29T23:26:31.447390821+02:00 [WARN] Unable to forbid exclusive full screen 2024-09-29T23:26:31.448591842+02:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-09-29T23:26:31.448681237+02:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-09-29T23:26:31.448751127+02:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: PreMultiplied } 2024-09-29T23:26:31.460386015+02:00 [INFO] Using GPU: GPUSpecs { is_software_emulated: false, device_name: "NVIDIA GeForce GTX 1050 Ti", driver_name: "NVIDIA", driver_info: "555.58.02" } 2024-09-29T23:26:31.46684779+02:00 [INFO] Initializing default prettier with plugins {} 2024-09-29T23:26:31.483704953+02:00 [INFO] Opening main db 2024-09-29T23:26:31.568045646+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.568169663+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.598186771+02:00 [INFO] Using surface present mode MAILBOX 2024-09-29T23:26:31.598306597+02:00 [WARN] Unable to forbid exclusive full screen 2024-09-29T23:26:31.604209952+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.60807621+02:00 [INFO] Initializing default prettier with plugins {} 2024-09-29T23:26:31.610890162+02:00 [INFO] Initializing default prettier with plugins {} 2024-09-29T23:26:31.612727915+02:00 [INFO] Opening main db 2024-09-29T23:26:31.613355631+02:00 [ERROR] no worktrees when constructing LocalLspAdapterDelegate 2024-09-29T23:26:31.615173643+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.615279368+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.634952155+02:00 [INFO] Initializing default prettier with plugins {} 2024-09-29T23:26:31.635974119+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.636313685+02:00 [INFO] Node runtime install_if_needed 2024-09-29T23:26:31.652636731+02:00 [INFO] Initializing default prettier with plugins {} 2024-09-29T23:26:31.653477776+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:31.784156979+02:00 [INFO] starting language server process. binary path: "/home/mh/.local/share/zed/node/node-v22.5.1-linux-x64/bin/node", working directory: "/", args: ["/home/mh/.local/share/zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"] 2024-09-29T23:26:32.356972326+02:00 [INFO] Language server with id 0 sent unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2024-09-29T21:26:32.349Z] Agent service starting", "metadataStr": "[DEBUG] [agent] [2024-09-29T21:26:32.349Z]", "extra": [ "Agent service starting" ] } 2024-09-29T23:26:32.358895703+02:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability: { "registrations": [ { "id": "c4c689c5-fb94-4c7d-997e-97c8e36ca6df", "method": "workspace/didChangeWorkspaceFolders", "registerOptions": {} } ] } 2024-09-29T23:26:32.415837128+02:00 [INFO] Language server with id 0 sent unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2024-09-29T21:26:32.367Z] Telemetry initialized", "metadataStr": "[DEBUG] [agent] [2024-09-29T21:26:32.367Z]", "extra": [ "Telemetry initialized" ] } 2024-09-29T23:26:36.277612212+02:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-09-29T23:26:36.288490388+02:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-09-29T23:26:36.301027187+02:00 [INFO] Creating a descriptor pool for at most 256 sets 2024-09-29T23:26:36.317376488+02:00 [INFO] Creating a descriptor pool for at most 256 sets 2024-09-29T23:26:40.300371754+02:00 [INFO] Initializing default prettier with plugins {} 2024-09-29T23:26:40.326075184+02:00 [WARN] request completed with error: failed to connect to the server 2024-09-29T23:26:48.506018268+02:00 [WARN] Acquire failed because the surface is out of date 2024-09-29T23:26:48.678819612+02:00 [ERROR] OtherError(IoError(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }))

mhanuszh avatar Sep 29 '24 21:09 mhanuszh

Thanks for checking, but now I'm somewhat clueless and would appreciate a perf (or anything analogous) sample to see hotspots better and not to guess.

SomeoneToIgnore avatar Sep 29 '24 21:09 SomeoneToIgnore

I never really used performance analysis tools, so I need to check how this perf works.

mhanuszh avatar Sep 29 '24 21:09 mhanuszh

I've found another selection-related culprit thanks to the other person who managed to capture the profile in https://github.com/zed-industries/zed/issues/19817

The PR is https://github.com/zed-industries/zed/pull/20031 and I'm pretty sure this should be solved with it too. Would love a confirmation, but will close this optimistically.

SomeoneToIgnore avatar Oct 31 '24 13:10 SomeoneToIgnore

I've found another selection-related culprit thanks to the other person who managed to capture the profile in #19817

The PR is #20031 and I'm pretty sure this should be solved with it too. Would love a confirmation, but will close this optimistically.

I can confirm it is fixed! Sorry for the late response.

mhanuszh avatar Nov 11 '24 17:11 mhanuszh

Thanks for confirming and no worries.

SomeoneToIgnore avatar Nov 11 '24 17:11 SomeoneToIgnore