probablepeople icon indicating copy to clipboard operation
probablepeople copied to clipboard

import probablepeople makes VScode debugger startup extremely slow

Open fabiosangregorio opened this issue 5 years ago • 1 comments

Expected Behavior

import probablepeople while debugging should take less than a second. python main.py command should take less than a second to complete, with main.py as follows:

import probablepeople
print('hello world')

Current Behavior

import probablepeople while debugging in VScode takes about 20 seconds. python main.py command takes less than a second to complete.0

Steps to Reproduce

  1. Create main.py with contents listed above
  2. Place a breakpoint on line 2.
  3. Start debug.
  4. Wait 20 seconds.
  5. The execution gets paused on the breakpoint.

Context (Environment)

  • Windows 10 64-bit
  • Visual Studio Code v1.32.3 x64
  • vscode-python debugger

What I tried

  • Reinstalled vscode-python
  • Tried multiple imports from heavy modules to check if the problem occurs with other imports

fabiosangregorio avatar Mar 29 '19 16:03 fabiosangregorio

I also opened an issue on the ptvsd repository. As they replied here:

I investigated this and unfortunately there's not much to be done in the debugger side (although it could be fixed in the probablepeople side and possibly on Python itself). So, what I found out is that the slowdown happens when probablepeople does: from .ratios import ratios -- the file imported (probablepeople/ratios.py) appears to have just a giant dictionary literal with more than 154k lines. The fix on probablepeople would be loading that data from a file instead of creating a giant dictionary

fabiosangregorio avatar Apr 09 '19 15:04 fabiosangregorio