zed icon indicating copy to clipboard operation
zed copied to clipboard

Severe performance regression with many LSP error spans

Open jansol opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

  1. Install vale and set up ~/.config/vale/.vale.ini or on macOS ~/Library/Application Support/vale/.vale.ini:
MinAlertLevel = suggestion

Packages = RedHat,  Readability, proselint

[*]
BasedOnStyles = Vale, RedHat, Readability, proselint
  1. run vale sync to fetch the configured rulesets
  2. install the vale extension in zed (and asciidoc for good measure, too)
  3. grab a snapshot or clone https://github.com/KhronosGroup/OpenCL-Docs and open extensions/cl_intel_unified_shared_memory.asciidoc
  4. watch zed freeze completely for 15 seconds

Environment

Ubuntu 24.04 GNOME Wayland Zed 0.151.0-dev

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

No response

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

No response

jansol avatar Aug 23 '24 17:08 jansol

In addition to freezing while opening the file, selecting text with the mouse is very sluggish in this situation.

jansol avatar Aug 23 '24 17:08 jansol

Here's another example:

  1. Clone CDDA git clone --depth 1 https://github.com/CleverRaven/Cataclysm-DDA.git
3. Replace .clang-tidy with this
Checks: "\
*,\
-abseil*,\
-altera*,\
-bugprone-easily-swappable-parameters,\
-cert-err58-cpp,\
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,\
-cppcoreguidelines-avoid-magic-numbers,\
-fuchsia*,\
-google-build-using-namespace,\
-google-default-arguments,\
-google-readability-todo,\
-hicpp-no-array-decay,\
-hicpp-uppercase-literal-suffix,\
-llvm-header-guard,\
-llvmlibc*,\
-modernize-use-trailing-return-type,\
-modernize-use-nodiscard,\
-readability-identifier-length,\
-readability-magic-numbers,\
"

basically turn on most things

  1. Generate a compilation database cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S . -B build && ln -s build/compile_commands.json .
  2. Open src/item.cpp in zed

That way you get ~600 annotations from the lsp and zed is extremely slow - it takes several seconds just to move the cursor.

andrei8l avatar Aug 24 '24 07:08 andrei8l

The gist of this issue is that we query diagnostic info on a frame-by-frame basis, regardless of whether we'll actually use it. We should allow language::Chunks type to omit fetching diagnostic info, just like it can omit doing syntax highlighting.

osiewicz avatar Aug 25 '24 00:08 osiewicz

This is a regression from https://github.com/zed-industries/zed/pull/15646; we used to not fetch diagnostic info for language-unaware iteration, but since that PR it is fetched unconditionally. The PR is on its way.

osiewicz avatar Aug 25 '24 12:08 osiewicz