1

Resolved

VS 2012 slower with python IDE

description

Hello,

VS is getting dog slow when I edit python files from a C++ solution. The solution is built using the 'Show All Files' button in the solution explorer. It's fine with a native python solution but unsuable with a C++ solution.

thanks
-mab

comments

Zooba wrote Oct 21, 2013 at 5:29 PM

Thanks for the report.

Are you able to provide a rough description of the files in your project? Number of .py files, .cpp files, subfolders, etc. We do some things differently when a .py file is opened outside of a project, which is what is happening here, so the slowness is likely related to that.

pymab wrote Oct 21, 2013 at 8:26 PM

Here's some more info on the solution I used:

~ 80 py files
~ 1600 sub folders
~ 1500 cpp files
~ 100 cc files
~ 4000 h files

-mab

Zooba wrote Oct 24, 2013 at 7:14 PM

I've been trying to reproduce this, but I can't simply based on the number of files. I have a few more questions:
  1. What is your default Python environment, and is its database up to date?
  2. Are there any errors shown in the Error List (View->Error List)?
  3. Is it slow from the beginning or does it get slower over time? Does closing/reopening VS fix it temporarily?

pymab wrote Oct 25, 2013 at 12:30 AM

  1. We use python 2.7. What do you mean by database up to date ?
  2. Nothing is logged in the error list
  3. No it is constantly slow from the beginning. My test is pretty simple:
    --open the task manager in the perf tab
    --start VS, load C++ solution, open python file from the solution
    --move cursor in the source editor and watch the cpu usage jumping to ~11% ( it goes to 7-8 % with a smaller solution of ~1400 files)

Zooba wrote Oct 25, 2013 at 8:36 PM

That's interesting. We don't really do anything when you move the cursor.

Do you have any other extensions installed? It may be that one of them doesn't like our Python support for some reason.

The database I mentioned is described briefly at the start of our IntelliSense documentation.

pymab wrote Oct 26, 2013 at 7:52 PM

The Python 2.7 Environment window says the Completion DB is up to date. Is this what you meant ?

Here's the list of installed extensions:
--MS Web Developer Tools
--MS.VisualStudio.InteractiveWindow
--Python Tools For Visual Studio
--Python Tools For Visual Studio, Django Support
--Python Tools For Visual Studio, IronPython Support
--Python Tools For Visual Studio, Profiling Support
--Visual Studio Extension For Windows Library For Javascript

-mab

Zooba wrote May 2 at 10:11 PM

I've just reproduced this with a Django Python project in VS 2013, and I suspect it is the same issue.

It only occurs when the file is not in the project. It looks like Microsoft.PythonTools.Extensions.GetAnalyzer() has a very slow path when the project is not associated with the active text buffer. This results in multiple CLR/native transitions as we use DTE to find the file in any open project.

This function is used heavily by the classifier, which is invoked frequently on open files. We should either cache the analyzer in the classifier or otherwise improve the slow path of GetAnalyzer().

Thanks for the report, and sorry it took so long to figure out what was going on.