Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylsp running very slowly #21076

Open
1 task done
alexrkaufman opened this issue Nov 22, 2024 · 8 comments
Open
1 task done

pylsp running very slowly #21076

alexrkaufman opened this issue Nov 22, 2024 · 8 comments
Labels
bug [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors performance Feedback for performance issues, speed, memory usage, etc python Python programming language support

Comments

@alexrkaufman
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Recently Zed switched to pylsp as the default linter. I am finding it runs much slower that pyright ran and I have had to change my settings to use pyright specifically instead of the default.

The gif below uses default zed settings for python linting as of 2024-11-22.

(It seems to lint better so I am happy with the switch otherwise.)

Environment

Zed: v0.162.5 (Zed)
OS: macOS 15.1.1
Memory: 16 GiB
Architecture: aarch64

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

Screen Recording 2024-11-22 at 1 09 34 PM

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

Zed.log

@alexrkaufman alexrkaufman added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Nov 22, 2024
@osiewicz
Copy link
Contributor

What is the source of the diagnostic in this video (this should be the prefix of it's contents)? As in, is it mypy or something else? I'm pretty positive that some of the issues with pylsp performance would have to be either fixed via our config (e.g. we should probably use dmypy instead of mypy) or upstream.

@alexrkaufman
Copy link
Author

I am not sure, I tested it by disabling pylsp and telling zed to use pyright again. When I did this it was back to running quickly. Then I disabled pyright and any other linters so it would use the zed defaults which caused it to run slowly so I made the gif.

The file sizes I had open weren't that large. A couple of files, two or three open between 100-400 lines.

I can replicate it again and try to get additional information if that would be helpful.

@andaag
Copy link

andaag commented Nov 28, 2024

@alexrkaufman can you share the config changes to move this back to pyright?

I have a codebase I'm working in where pylsp goes to 100% cpu and just sits there. Both completion and linting is completely broken since this change.

@carlosds731
Copy link

@alexrkaufman can you share the config changes to move this back to pyright?

I have a codebase I'm working in where pylsp goes to 100% cpu and just sits there. Both completion and linting is completely broken since this change.

Just use "language_servers": ["!pylsp", "pyright"]

"languages": {
    "Python": {
      "language_servers": ["!pylsp", "pyright"],
  }

@gitriff
Copy link

gitriff commented Dec 2, 2024

Yeah I am having the same issue. Running the same hardware as op. I can try to help debug this. Let me know if there is anything special you want me to capture (logs, profiling etc)

@afandian
Copy link

Another +1 here. Ubuntu 22.04.5, Intel i7, 16GB. Crawling slow with pylsp, snappy with pyright. I did notice a large number of pylsp processes running (about 10?). Not sure if that's expected.

@JosephTLyons JosephTLyons added performance Feedback for performance issues, speed, memory usage, etc python Python programming language support language An umbrella label for all programming languages syntax behaviors language server An umbrella label for all language servers and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Dec 12, 2024
@achimnol
Copy link

I just hit this issue, too. pylsp mypy is following the typing sequence with a few seconds delays per each.

@isatsam
Copy link

isatsam commented Dec 22, 2024

It seems that at least some of the lag comes from the new LSP aggressively scanning the entirety of your venv for "errors". Copying my own screenshot from this discussion:
image

Currently still observing these issues:

Zed: v0.166.2 (Zed)
OS: Linux Wayland arch unknown
Memory: 23.3 GiB
Architecture: x86_64
GPU: AMD Radeon Graphics (RADV RENOIR) || radv || Mesa 24.3.1-arch1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors performance Feedback for performance issues, speed, memory usage, etc python Python programming language support
Projects
None yet
Development

No branches or pull requests

9 participants