Skip to content

Running code using the run button in VSC delayed #24239

Closed

Description

@FraidOfWater

Type: Performance Issue

Code executes only after a large delay on the newest version when excecuted from vsc's "run" button.

Diagnostic data

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)


Behaviour

The command to run the script isn't inserted into the terminal until after a large delay. This doesn't happen if you manually do ctrl+F5 or F5.

Old perfromance: (v.2024.14.1)
Code_QtxmNuMFwv

New performance: (The only changed component is that this version is v.2024.16.0.
Code_VV9mwyYHQ8

Steps to reproduce:

  1. If you run python code with the python extension v2024.16.0 by pressing the visual studio code run button, there is a severe delay until the program decides to excecute. Downgrading to v2024.14.1 directly solves the issue. This happens on windows.

Diagnostic data

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

XXX

Extension version: 2024.14.1 (mistake, I reported the bug from the previous version, correct bugged version is 2024.16.0)
VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Windows_NT x64 10.0.22631
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.6
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
JavaScript Debugger ms-vscode.js-debug 1.94.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Pylance ms-python.vscode-pylance 2024.9.1
Python ms-python.python 2024.14.1
Python Debugger ms-python.debugpy 2024.10.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
System Info
Item Value
CPUs AMD Ryzen 5 5600X 6-Core Processor (12 x 3700)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.93GB (22.52GB free)
Process Argv C:\Users\4f736\Desktop\Sourcetest\dev\canvasimage.py --crash-reporter-id 5f987fe4-e9aa-43c0-93ec-dc7ee6464594
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   129	 15332	code main
    0	   144	  5916	ptyHost
    0	     7	  1908	     conpty-agent
    0	     7	  2084	     conpty-agent
    0	    73	  3100	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	    66	  7140	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	    68	  8348	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	     7	  8680	     conpty-agent
    0	    66	  9280	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	     7	  9656	     conpty-agent
    0	    66	 13576	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	     6	 16600	     conpty-agent
    0	    66	 16620	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	    66	 16840	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	     7	 17056	     conpty-agent
    0	     6	 17332	     conpty-agent
    0	    69	 18072	     C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Users\4f736\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	     7	 19256	     conpty-agent
    0	   104	  5936	   window
    0	   123	  6376	shared-process
    0	   134	  7224	   gpu-process
    0	    86	 12752	fileWatcher [1]
    0	   169	 12812	extensionHost [1]
    0	     5	  4868	     c:\Users\4f736\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python-env-tools\bin\pet.exe server
    0	    10	  6460	       C:\Windows\system32\conhost.exe 0x4
    0	   186	 13788	     electron-nodejs (bundle.js )
    0	   289	 13152	window [1] (Extension: Python - Visual Studio Code)
    0	    31	 16932	   crashpad-handler
    0	    48	 19268	   utility-network-service
Workspace Info
;
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
9c06g630:31013171
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
flighttreat:31134774
wkspc-onlycs-t:31132770
wkspc-ranged-t:31151552
cf971741:31144450
autoexpandse:31146404
iacca2:31150323
notype1cf:31151524
cc771715:31146322

Activity

  1. karthiknadig commented on Oct 4, 2024

    @karthiknadig
    Member

    Anthony Kim (@anthonykim1) This looks like Shell integration taking too long. If we need to use sendText once, we should just disable shell integration from that point onwards.

  2. starball5 commented on Oct 4, 2024

    @starball5
  3. anthonykim1 commented on Oct 4, 2024

    @anthonykim1

    Thanks for filing this FraidOfWater. I'm looking into resolving this. Could you set your log level to trace and share the logs for Python?

  4. FraidOfWater commented on Oct 4, 2024

    @FraidOfWater
    Author

    Hey Anthony Kim (@anthonykim1) , thanks for replying. Here is my VSC stack trace for python. I hope this is what you meant. It was my mistake for not including it. https://pastebin.com/pxPePWgX

    Edit: I seem to have posted the diagnostic data wrong. It says Extension version: 2024.14.1 although It is really 2024.16.0. I must've downgraded and reported it then. I have added corrected diagnostic data at the end.

    Edit: Full trace logs here (I figured how to set it as default so it traces when starting up VSC):
    Note: here the we are trying to run a simpler program "Hello World!".
    https://pastebin.com/TJPx7hP8 Old version
    https://pastebin.com/k0zuWMHh New version

    I do get this new delay also on another machine.

    Note I turn tracing on only after VSC has started with ">Developert:Set Log Level" to trace all
    This is what happens with the old version:

    2024-10-05 01:33:34.186 [info] Experiment 'pythonRecommendTensorboardExt' is active
    2024-10-05 01:33:34.186 [info] Experiment 'pythonTerminalEnvVarActivation' is active
    2024-10-05 01:33:34.186 [info] Experiment 'pythonTestAdapter' is active
    2024-10-05 01:33:34.186 [info] Python interpreter path: ~\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:34.254 [info] > pixi --version
    2024-10-05 01:33:34.256 [warning] could not find a pixi interpreter for the interpreter at C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:34.286 [warning] could not find a pixi interpreter for the interpreter at C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:35.156 [info] Starting Pylance language server.
    2024-10-05 01:33:43.890 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:46.901 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:48.854 [debug] Attempting to run Python file c:\Users\4f736\Desktop\Sourcetest\dev\canvasimage.py
    2024-10-05 01:33:48.854 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:48.857 [info] CreateEnv Trigger - Workspace not found for c:\Users\4f736\Desktop\Sourcetest\dev\canvasimage.py
    2024-10-05 01:33:48.867 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:48.869 [debug] Terminal shell path 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' identified as shell 'powershell'
    2024-10-05 01:33:48.869 [debug] Shell identified as powershell
    2024-10-05 01:33:48.969 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:33:48.969 [info] Send text to terminal: & C:/Users/4f736/AppData/Local/Programs/Python/Python312/python.exe c:/Users/4f736/Desktop/Sourcetest/dev/canvasimage.py
    2024-10-05 01:33:53.403 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe

    This is what happens in the new version:

    2024-10-05 01:34:29.033 [info] Experiment 'pythonRecommendTensorboardExt' is active
    2024-10-05 01:34:29.033 [info] Experiment 'pythonTerminalEnvVarActivation' is active
    2024-10-05 01:34:29.034 [info] Experiment 'pythonTestAdapter' is active
    2024-10-05 01:34:29.034 [info] Python interpreter path: ~\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:34:29.363 [info] > pixi --version
    2024-10-05 01:34:30.260 [info] Starting Pylance language server.
    2024-10-05 01:34:37.681 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:34:40.253 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:34:42.115 [debug] Attempting to run Python file c:\Users\4f736\Desktop\Sourcetest\dev\canvasimage.py
    2024-10-05 01:34:42.116 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:34:42.117 [info] CreateEnv Trigger - Workspace not found for c:\Users\4f736\Desktop\Sourcetest\dev\canvasimage.py
    2024-10-05 01:34:42.117 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:34:42.118 [debug] Terminal shell path 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' identified as shell 'powershell'
    2024-10-05 01:34:42.118 [debug] Shell identified as powershell
    2024-10-05 01:34:42.224 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    2024-10-05 01:34:45.236 [info] Send text to terminal: & C:/Users/4f736/AppData/Local/Programs/Python/Python312/python.exe c:/Users/4f736/Desktop/Sourcetest/dev/canvasimage.py
    2024-10-05 01:34:45.236 [debug] Shell Integration is disabled, sendText: & C:/Users/4f736/AppData/Local/Programs/Python/Python312/python.exe c:/Users/4f736/Desktop/Sourcetest/dev/canvasimage.py
    2024-10-05 01:34:47.247 [debug] Found cached env for C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe

    It looks like the lines from the old version:

    [warning] could not find a pixi interpreter for the interpreter at C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe
    [warning] could not find a pixi interpreter for the interpreter at C:\Users\4f736\AppData\Local\Programs\Python\Python312\python.exe

    and the lines from the new version:

    2024-10-05 01:34:29.033 [info] Experiment 'pythonRecommendTensorboardExt' is active
    2024-10-05 01:34:45.236 [debug] Shell Integration is disabled, sendText: & C:/Users/4f736/AppData/Local/Programs/Python/Python312/python.exe c:/Users/4f736/Desktop/Sourcetest/dev/canvasimage.py

    don't match

    for repeated pressing, I seem to get this as the only difference:

    2024-10-05 01:34:45.236 [debug] Shell Integration is disabled, sendText: & C:/Users/4f736/AppData/Local/Programs/Python/Python312/python.exe c:/Users/4f736/Desktop/Sourcetest/dev/canvasimage.py

    Also I do not know the significance of this, but for both versions I do get this error next to the terminal
    Code_ZtVjWqwmNG

    Correct diagnostic data:
    Note: I have added extensions to run java, sorry for that. I don't think there are any other changes to this data.

    Extension version: 2024.16.0
    VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
    OS version: Windows_NT x64 10.0.22631
    Modes:

    • Python version (& distribution if applicable, e.g. Anaconda): 3.12.6
    • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
    • Value of the python.languageServer setting: Pylance
    User Settings

    
    languageServer: "Pylance"
    
    

    Installed Extensions
    Extension Name Extension Id Version
    Debugger for Java vscjava.vscode-java-debug 0.58.0
    Extension Pack for Java vscjava.vscode-java-pack 0.29.0
    Gradle for Java vscjava.vscode-gradle 3.16.4
    IntelliCode VisualStudioExptTeam.vscodeintellicode 1.3.1
    IntelliCode API Usage Examples VisualStudioExptTeam.intellicode-api-usage-examples 0.2.8
    Java Oracle.oracle-java 22.1.2
    JavaScript Debugger ms-vscode.js-debug 1.94.0
    JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
    Language Support for Java(TM) by Red Hat redhat.java 1.35.1
    Maven for Java vscjava.vscode-maven 0.44.0
    Project Manager for Java vscjava.vscode-java-dependency 0.24.0
    Pylance ms-python.vscode-pylance 2024.9.2
    Python ms-python.python 2024.16.0
    Python Debugger ms-python.debugpy 2024.10.0
    Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
    Test Runner for Java vscjava.vscode-java-test 0.42.0
    System Info
    Item Value
    CPUs AMD Ryzen 5 5600X 6-Core Processor (12 x 3700)
    GPU Status 2d_canvas: enabled
    canvas_oop_rasterization: enabled_on
    direct_rendering_display_compositor: disabled_off_ok
    gpu_compositing: enabled
    multiple_raster_threads: enabled_on
    opengl: enabled_on
    rasterization: enabled
    raw_draw: disabled_off_ok
    skia_graphite: disabled_off
    video_decode: enabled
    video_encode: enabled
    vulkan: disabled_off
    webgl: enabled
    webgl2: enabled
    webgpu: enabled
    webnn: disabled_off
    Load (avg) undefined
    Memory (System) 31.93GB (20.73GB free)
    Process Argv --log trace --crash-reporter-id 5f987fe4-e9aa-43c0-93ec-dc7ee6464594
    Screen Reader no
    VM 0%
    A/B Experiments
    vsliv368:30146709
    vspor879:30202332
    vspor708:30202333
    vspor363:30204092
    vscod805:30301674
    binariesv615:30325510
    vsaa593:30376534
    py29gd2263:31024239
    vscaat:30438848
    c4g48928:30535728
    azure-dev_surveyone:30548225
    962ge761:30959799
    pythongtdpath:30769146
    welcomedialogc:30910334
    pythonnoceb:30805159
    asynctok:30898717
    pythonmypyd1:30879173
    h48ei257:31000450
    pythontbext0:30879054
    accentitlementsc:30995553
    dsvsc016:30899300
    dsvsc017:30899301
    dsvsc018:30899302
    cppperfnew:31000557
    dsvsc020:30976470
    pythonait:31006305
    dsvsc021:30996838
    9c06g630:31013171
    a69g1124:31058053
    dvdeprecation:31068756
    dwnewjupyter:31046869
    impr_priority:31102340
    nativerepl1:31139838
    refactort:31108082
    pythonrstrctxt:31112756
    flighttreat:31134774
    wkspc-onlycs-t:31132770
    wkspc-ranged-t:31151552
    cf971741:31144450
    autoexpandse:31146404
    iacca2:31150323
    notype1cf:31151524
    cc771715:31146322
    
    
  5. anthonykim1 commented on Nov 11, 2024

    @anthonykim1

    Could you try the latest pre-release version of Python extension? This would've gotten better with #24248

    Let me know if you have any complains. Thanks!

  6. FraidOfWater commented on Nov 12, 2024

    @FraidOfWater
    Author

    Yeah you guys fixed it already in version 16.1 it seems! Super smooth now, all good, cheers!

  7. anthonykim1 commented on Nov 12, 2024

    @anthonykim1

    Happy to hear that, please let us know here or in new issue if this problem ever occurs again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions