sublimelsp / LSP-pylsp

Convenience package for the Python Language Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance Questions

dbazile opened this issue · comments

Performance for showing the completion menu is VERY slow (takes over 3 seconds to appear for a 150-line Python script even for primitive types like str). Confirmed that this happens on two different machines: gen 10 i7s with 16GB and 64GB of RAM respectively so hardware isn't the bottleneck.

  1. Does anyone else see slowdowns to this degree?
  2. Are there any settings I can disable to improve performance?
  3. Is there a way to profile/trace to see where in the stack the slowdown is happening?

Versions

Fedora 35
Sublime v 4126
Python v3.10.4
LSP v1.16.2
LSP-pylsp v2.3.3

Configs

LSP-pylsp.sublime-settings

{
    "settings": {
        "pylsp.plugins.pyflakes.enabled": false,
        "pylsp.plugins.pylsp_mypy.enabled": false,
        "pylsp.plugins.mccabe.enabled": false,
        "pylsp.plugins.preload.enabled": false,

        "pylsp.plugins.pycodestyle.enabled": false,
        "pylsp.plugins.pycodestyle.ignore": [
            "E221",
            "E241",
            "E501",
            "W504",
        ],
    }
}

LSP.sublime-settings

{
    "document_highlight_style": "fill",
}

Finally, thanks for your work. This thing does almost everything I need it to, just unbearably slowly...

Try LSP-pyright instead.

Try LSP-pyright instead.

I would were it not for the NodeJS requirement. :)

Think I found the culprit. Looks like the rope plugin bogs things down considerably.

Was able to get the completions list appearance time from ~4s to <1s with this in LSP-pylsp.sublime-settings:

{
    "settings": {
        "pylsp.plugins.rope_completion.enabled": false,
    },
}

Should probably disable it by default then.

Some relevant issue from another LSP: emacs-lsp/lsp-mode#923

Rope completions indeed seem to be disabled by default in pylsp: https://github.com/python-lsp/python-lsp-server/blob/4bffc39ca6923a007b084d13f67a8f2ea10613ad/pylsp/plugins/rope_completion.py#L16

Though their documentation is out of sync and says that it's enabled by default: https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md

@dbazile would you like to make a PR to disable rope by default?

Will do as I'm updating the package already.