Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running many "display" statements hangs VS Code for almost a minute #1263

Closed
DataScientistsR7337 opened this issue Jun 26, 2020 · 2 comments
Closed
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@DataScientistsR7337
Copy link

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

Run the following code twice.

Running it in jupyterlab is almost instantaneous.

%%

%%timeit -n 1 -r 1

testvec2 = [[1] * 20] * 200
for i, val in enumerate(testvec2):
    print(f"Using print: {val}")
    display(val)

The loops themselves are quick enough, the cell is executed in 353ms. The rest of the time is Vs Code trying to do the actual drawing in the notebook. The dev tools log seems to finish the logging way before the Notebook UI is completed.

Actual behavior

The first run takes 9s on my computer.
The second run takes 55 seconds(!!).

Expected behavior

No hanging. Same execution speed as Jupyter Lab which is below one second no matter how many cells that contain the same statement as above.

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: v2020.6.90262
  • VS Code version: 1.46.1
  • Setting python.jediEnabled: false
  • Setting python.languageServer: Microsoft
  • Python and/or Anaconda version: 3.8.2
  • OS: Windows
  • Virtual environment: conda

Developer Tools Console Output

console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Waiting for jupyter server and web panel ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Loading web panel. Panel is notset
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Loading web view...
console.ts:137 [Extension Host] Warn Python Extension: 2020-06-26 12:47:59: startHttpServer=false, will not be used. Temporarily turned off
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Web view created.
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Cached data exists getEnvironmentVariables, c:\Projects\xxxxxx.py
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Python Daemon (pid: 26252): write to stderr: [I 12:47:59.673 NotebookApp] Creating new notebook in /
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Python Daemon (pid: 26252): write to stderr: [I 12:47:59.749 NotebookApp] Kernel started: bd70cbd4-f88e-41ca-a168-ec1cfded16e8
console.ts:137 [Extension Host] Starting WebSocket: ws://localhost:8888/api/kernels/bd70cbd4-f88e-41ca-a168-ec1cfded16e8
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Started session b0ac5abc-cdc7-42df-932d-12adf3c64de0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Waiting for idle (session) b0ac5abc-cdc7-42df-932d-12adf3c64de0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:47:59: Waiting for idle on (kernel): bd70cbd4-f88e-41ca-a168-ec1cfded16e8 -> unknown
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Web view react rendered
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Request for onigasm file at c:\Users\stora\.vscode\extensions\ms-python.python-2020.6.90262\out\client\node_modules\onigasm\lib\onigasm.wasm
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Request for tmlanguage file.
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Searching for token colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Kernel: connected (bd70cbd4-f88e-41ca-a168-ec1cfded16e8)
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Finished waiting for idle on (kernel): bd70cbd4-f88e-41ca-a168-ec1cfded16e8 -> idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Attempting search for colors ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:00: Loading base colors from c:\Program Files\Microsoft VS Code\resources\app\extensions\theme-monokai-dimmed\themes\dimmed-monokai-color-theme.json ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Using colors to generate CSS ...
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Initialize config for plots for history://ec155b3b-dc18-49dc-9e99-9a948aa2f27b
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Python Daemon (pid: 26252): write to stderr: [I 12:48:01.061 NotebookApp] Creating new notebook in /
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Python Daemon (pid: 26252): write to stderr: [I 12:48:01.133 NotebookApp] Kernel started: 246d4ad5-81f2-47c3-8c5a-265004d9d2b2
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Run startup code for notebook: %config Completer.use_jedi = False - results: 1
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Initial setup complete for history://ec155b3b-dc18-49dc-9e99-9a948aa2f27b
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Finished connecting b0ac5abc-cdc7-42df-932d-12adf3c64de0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Registering commtarget jupyter.widget
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Adding sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0
console.ts:137 [Extension Host] Starting WebSocket: ws://localhost:8888/api/kernels/246d4ad5-81f2-47c3-8c5a-265004d9d2b2
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Waiting for idle on (kernel): 246d4ad5-81f2-47c3-8c5a-265004d9d2b2 -> unknown
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0 complete
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Submitting code for a8970cf0-68c4-4896-b413-8675115d64b0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Loading web panel. Panel is set
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Wait for sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Wait for sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Adding hash for 1 = 3b785743a102 with 7 lines
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to busy
webviewElement.ts:331 [Embedded Page] Starting WebSocket: BOGUS_PVSC/api/kernels/bd70cbd4-f88e-41ca-a168-ec1cfded16e8
webviewElement.ts:331 [Embedded Page] Kernel: connected (bd70cbd4-f88e-41ca-a168-ec1cfded16e8)
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:01: Finished execution for 910362be-1049-43a4-bf03-f27bfb4f4878
console.ts:137 [Extension Host] Kernel: connected (246d4ad5-81f2-47c3-8c5a-265004d9d2b2)
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:02: Finished waiting for idle on (kernel): 246d4ad5-81f2-47c3-8c5a-265004d9d2b2 -> idle
webviewElement.ts:331 [Embedded Page] Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq
webviewElement.ts:331 [Embedded Page] Failed to construct 'Worker': Script at 'vscode-resource://file///c%3A/Projects/rustpython/python_code/editor.worker.js' cannot be accessed from origin 'null'.
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Loading web panel. Panel is set
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Wait for sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Submitting code for a8970cf0-68c4-4896-b413-8675115d64b0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Loading web panel. Panel is set
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Wait for sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Wait for sys info for a8970cf0-68c4-4896-b413-8675115d64b0 0
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Adding hash for 2 = 3b785743a102 with 7 lines
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Kernel switching to busy
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Kernel switching to idle
console.ts:137 [Extension Host] Info Python Extension: 2020-06-26 12:48:14: Finished execution for 2a4ea016-fcc1-472c-99af-fdc8bad781b1

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

@claudiaregio
Copy link
Contributor

Thanks @DataScientistsR7337 , I am able to repro this.

DonJayamanne referenced this issue in microsoft/vscode-python Jul 3, 2020
For #12588

At least in VS Code Notebooks, the improvement is fairly significant.
Down from 3minutes to 5 seconds.

Note: This doesn't completely resolve the slow times experienced in the existing Notebook Editor.
We have delays due to UI updates there (however that too is down from 3minutes to ~15 seconds).
That might probably need to be addressed separately.

Either way its a significantly improvement.
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 13, 2020
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug temp-nice-for-october labels Nov 13, 2020
@greazer greazer added the P2 label Nov 14, 2020
@greazer
Copy link
Member

greazer commented Jun 6, 2021

Thanks for your feedback. This issue will be addressed once VS Code adds native support for editing notebooks. Please see microsoft/vscode#91987. You can experiment by using VS Code insiders, which defaults to the new notebook experience.

@greazer greazer closed this as completed Jun 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants