microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 292 forks source link

Jupyter: Variables explorer extremely slow for certain data types #15838

Open ejohnsson6 opened 4 months ago

ejohnsson6 commented 4 months ago

Applies To

What happened?

The following cell runs in < 1s and show up instantly in the variables explorer.

import numpy as np

bla = np.random.rand(10000000, 10)

This also runs in < 1s. However, it takes several minutes for bla2 to show up in the variables explorer.

import numpy as np

bla = np.random.rand(10000000, 10)
bla2 = [i for i in bla]

While the variable explorer is loading, all further cell executions are blocked image

Logs don't show much. If the varaibles window is closed all is fast again.

I'm geussing the reason it is so slow is because it's fetching more metadata if it's a list and not a numpy array? Would be awesome if it was possbile to disable this for lists above a certain size. Even having the option to disable showing lists and dicts in the variable explorer would be preferable as it currently takes 10 min to rerun cells.

The problem is also present for dicts.

import numpy as np

bla = np.random.rand(10000000, 10)
bla2 = {i[0]: i[1] for i in bla}

VS Code Version

1.91.0-insider

Jupyter Extension Version

v2024.6.2024070901 (pre-release)

Jupyter logs

N/A

Coding Language and Runtime Version

python 3.12.4

Language Extension Version (if applicable)

v2024.11.2024070901 (pre-release)

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

ejohnsson6 commented 4 months ago

Adding "jupyter.variableExplorerExclude": "module;function;builtin_function_or_method;list;dict" to the settings is a temp fix to make it usable while working with large lists/dicts. But obviously not ideal.

kale-ha commented 2 months ago

Is this issue solved? I still having trouble for same issue..

amunger commented 2 months ago

It should be resolved in the new variables view that shows up in the debug sidebar with "notebook.experimental.variablesView": true. I'll re-open this until we start trying to move over to using that view by default.