question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

renaming python variable is too slow

See original GitHub issue

Environment data

  • VS Code version: 1.47.1
  • Extension version (available under the Extensions sidebar): v2020.7.94776
  • OS and version: MacOS 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Rename a variable succeed in 1 second.

Actual behaviour

Rename a variable succeed in 50 seconds

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Find a python script with about 400 lines.
  2. Right-click a variable and select rename, key in the new name, and press the “Enter” button.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:28 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
wenmin-wucommented, Jan 10, 2021

I close this issue because it’s resolved by using "python.languageServer": "Pylance" as the language server. The renaming can be done immediately even in a file with ~3000 lines of Python code.

3reactions
karthiknadigcommented, Apr 21, 2021

@MaxFBurg You may have to file this on the language servers depending on which one you are using. If you have Jedi as the language server it uses rope for refactoring. rope is outdated and slow. At this point we are transitioning people from Jedi to JediLSP, so try JediLSP as the language server setting and see if it helps. If you still feel it is slow then please file a bug on https://github.com/davidhalter/jedi

If the language server is Microsoft, this will also be deprecated soon. So replace that with Pylance (you may need to install pylance extension), and see if it helps. If Pylance is slow then please file a bug on https://github.com/microsoft/pylance-release

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code - Rename symbol too slow for Python - Stack Overflow
It is taking around 5 min to do the renaming (also with variable names). Is this a normal behaviour? I have about 10...
Read more >
PythonSpeed/PerformanceTips - Python Wiki
When found to be slow, profiling can show what parts of the program are consuming most of the time. A comprehensive but quick-to-run...
Read more >
How to Rename Columns in Pandas — With Upto 4X Speed
Pandas' performance gets slowed down by copying going on underneath the hood. Looking at renaming columns, let's see how the hidden copying mechanism...
Read more >
The 10 Most Common Mistakes That Python Developers Make
Why? Because, as reported here, when the interpreter shuts down, the module's global variables are all set to None . As a result,...
Read more >
Do longer variable names make a program slower? - Quora
While I know compilers and interpreters are complex beast that do things we don't expect, in general variable name lengths don't change performance....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found