Skip to content

Heavy CPU usage #2149

Closed
Closed

Description

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): 2018.6.0
  • OS and version: MacOS High Sierra
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Conda
  • Relevant/affected Python packages and their versions: Dash 0.21.1

Actual behavior

I am writing an app using Dash library. The extension would fire up a python process pretty frequently that is pretty CPU heavy. I am not sure what the process does, but I am suspecting that it is trying to do something that helps the autocompletion feature. Also, the autocomplete or suggestions are pretty slow. Anybody else with the same experience?

Activity

  1. MikhailArkhipov commented on Jul 13, 2018

    @MikhailArkhipov

    I assume you are using default Jedi completion. I wonder if you can try insider's build and set python.jediEnabled to false to try new Python language server.

  2. amirhosseindavoody commented on Jul 13, 2018

    @amirhosseindavoody
    Author

    Thanks for the tip. I will try it out and let you know how it goes.

  3. changed the title [-]Performance issue[/-] [+]Heavy CPU usage[/+] on Jul 13, 2018
  4. samhinshaw commented on Jul 21, 2018

    @samhinshaw

    I am having this issue as well! Tested on code 1.25 and insiders 1.26 (2018-07-20). Python extension version 2018.7.0. I am using a python 3.6.5 venv via pyenv with yapf autoformatting. MacOS High Sierra 10.13.6.

    Tested with "python.jediEnabled": false and not.

  5. samhinshaw commented on Jul 25, 2018

    @samhinshaw

    It seems to be tied to linting. When I save, CPU usage spikes and my pylint results take quite a while to appear. Once the linting results have appeared, CPU usage returns to normal. Interestingly, the CPU usage does not appear in Code's Process Explorer, but does appear in Activity Monitor.

    CPU %	Memory (MB)	pid	Name
    2	115	98038	code main
    5	147	98104	     gpu-process
    0	311	98110	     window (course.py — rudaux)
    0	197	98113	         extensionHost
    0	66	98363	             /Users/samhinshaw/.pyenv/versions/recent/bin/python completion.py
    0	16	98406	                 python3.6 /Users/samhinshaw/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles/jedi/evaluate/compiled/subprocess/__main__.py /Users/samhinshaw/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles
    0	16	99366	                 /Users/samhinshaw/.pyenv/versions/recent/bin/python /Users/samhinshaw/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles/jedi/evaluate/compiled/subprocess/__main__.py /Users/samhinshaw/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles
    0	49	98114	         watcherService
    0	49	98212	         searchService
    0	131	98115	     shared-process
    0	229	98751	     window (rudaux_config.py — DSCI_100_instructors)
    0	147	98752	         extensionHost
    0	16	99134	             python completion.py
    0	16	99155	                 /Users/samhinshaw/.pyenv/versions/3.6.5/envs/recent/bin/python 
    /Users/samhinshaw/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles/jedi/evaluate/compiled/subprocess/__main__.py /Users/samhinshaw/.vscode/extensions/ms-python.python-2018.7.1/pythonFiles
    0	49	98753	         watcherService
    0	49	98899	         searchService
    

    shot-crop

    More information in a gist

  6. anribras commented on Jul 27, 2018

    @anribras

    Same issues .

    Code version: 1.25.1
    vs-python : 2018.7.1

    Cpu load is really huge when Jedi is doing some completion job and all operations become very slow.

  7. brettcannon commented on Aug 2, 2018

    @brettcannon
    Member

    anribras what OS are you running?

    Amirhossein Davoody (@amirhosseindavoody) Are you running Pylint?

  8. anribras commented on Aug 2, 2018

    @anribras

    Brett Cannon (@brettcannon) Ubuntu 16.04
    I think VS Code completion for large-scale external libs like wxpython , is really slow , and much slower than Pycharm I have to say. Maybe Jedi should be the reason.

  9. brettcannon commented on Aug 2, 2018

    @brettcannon
    Member

    anribras I'm sure Jedi is the reason, which is why we are asking folks to try the experimental language server to see how that performs for them.

  10. amirhosseindavoody commented on Aug 3, 2018

    @amirhosseindavoody
    Author

    Brett Cannon (@brettcannon) I am using the experimental python server for about a week but still seeing the same high cpu usage.

  11. brettcannon commented on Aug 3, 2018

    @brettcannon
    Member

    Amirhossein Davoody (@amirhosseindavoody) do have any code you can share which exhibits the high CPU usage?

  12. samhinshaw commented on Aug 8, 2018

    @samhinshaw

    So what's interesting is that my project recently stopped exhibiting this behavior to such a degree. Usage will spike to ~99%, but only for about a second.

    Unfortunately, I don't have to time to try to recreate a minimum viable example, but I can provide you with two files:

    1. Exhibits the bug do a severe degree (an older version of the offending file, CPU Usage spikes for at least 10 seconds).
    2. Does not exhibit the bug appreciably (the current version of the offending file, only spikes for ~1sec).

    I understand if these are too verbose to be helpful, but maybe they will still provide some insight. I will try to revisit this if I can.

  13. MikhailArkhipov commented on Aug 9, 2018

    @MikhailArkhipov

    Occasional spike is normal, analysis runs several threads run when text buffer changes.

  14. romanbsd commented on Aug 15, 2018

    @romanbsd

    I think that it's related to pylint.

  15. raytroop commented on Aug 26, 2018

    @raytroop

    I think Jedi is the root of cpu spike, it's slow and resource expensive for vscode. "python.jediEnabled": false save my cpu.

  16. brettcannon commented on Aug 27, 2018

    @brettcannon
    Member

    Unless someone can provide a code sample that reproduces for the language server I'm going to close this as just a side-effect for Jedi and/or Pylint simply being expensive to run and not the direct fault of the extension.

  17. locked as resolved and limited conversation to collaborators on Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions