Repository: spyder-ide/spyder

Issue:
Variable explorer is very slow
The variable explorer in Spyder 5.1.1 performs very slowly. Consider the following example:

```
my_list = []

for i in range(300):
    # already slow
    # my_list.append(i)

    # more complex list --> even slower variable explorer
    a = (i, (2*i, 3*i, 4*i))
    my_list.append(a)  
```

The list `my_list` appears correctly in the variable explorer. But it is almost impossible to inspect the list in the variable explorer, the respective dialog freezes constantly. Problems can be observed already for the simple test case and are more severe for the complex list. I observed this behavior on two different computers with fresh installations. Inspecting the same list in Spyder 3.3.6 is no problem.


Discussion:
Hey @andprosoft, thanks for reporting. I can't reproduce this problem, sorry. Please post a video or an animated gif that displays it.

Also, please provide the minimal necessary information to reproduce it:

* Qt/PyQt versions
* Operating system
* Spyder dependencies
* Installation method (Anaconda/Conda-forge, installer, pip).
Hi @ccordoba12, thanks for reaching out. This is what it looks like on my systems:

![variable_explorer_spyder5_4](https://user-images.githubusercontent.com/79669161/130139840-7425af14-d10f-4c0f-8c55-b4d044f203bf.gif)

The dialog very unresponsive. At the end, the dialog is still open, but behind the Spyder GUI and not visible in the animation.

This is the same script with Spyder 3.3.6

![variable_explorer_spyder3_2](https://user-images.githubusercontent.com/79669161/130139975-b24867d2-cc44-4bc4-bb56-27c5ffcb0045.gif)

For this test, I have created a new environment in the Anaconda Navigator GUI. Then, using the Anaconda Prompt, I have installed Spyder with the command `conda install spyder` (using the conda-forge repository). Please find below the list of modules. Operating System is Windows 10 20H2.

<details>

```
alabaster                 0.7.12                     py_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
argh                      0.26.2          pyh9f0ad1d_1002    conda-forge
arrow                     1.1.1              pyhd8ed1ab_0    conda-forge
astroid                   2.5.8            py38haa244fe_0    conda-forge
async_generator           1.10                       py_0    conda-forge
atomicwrites              1.4.0              pyh9f0ad1d_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
autopep8                  1.5.7              pyhd8ed1ab_0    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
bcrypt                    3.2.0            py38h294d835_1    conda-forge
binaryornot               0.4.4                      py_1    conda-forge
black                     21.7b0             pyhd8ed1ab_0    conda-forge
bleach                    4.0.0              pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py38h294d835_1001    conda-forge
ca-certificates           2021.5.30            h5b45459_0    conda-forge
certifi                   2021.5.30        py38haa244fe_0    conda-forge
cffi                      1.14.6           py38hd8c33c5_0    conda-forge
chardet                   4.0.0            py38haa244fe_1    conda-forge
charset-normalizer        2.0.0              pyhd8ed1ab_0    conda-forge
click                     8.0.1            py38haa244fe_0    conda-forge
cloudpickle               1.6.0                      py_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
cookiecutter              1.7.3              pyh6c4a22f_0    conda-forge
cryptography              3.4.7            py38hd7da0ea_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
debugpy                   1.4.1            py38h885f38d_0    conda-forge
decorator                 5.0.9              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
diff-match-patch          20200713           pyh9f0ad1d_0    conda-forge
docutils                  0.17.1           py38haa244fe_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
flake8                    3.9.2              pyhd8ed1ab_0    conda-forge
icu                       68.1                 h0e60522_0    conda-forge
idna                      3.1                pyhd3deb0d_0    conda-forge
imagesize                 1.2.0                      py_0    conda-forge
importlib-metadata        4.6.4            py38haa244fe_0    conda-forge
importlib_metadata        4.6.4                hd8ed1ab_0    conda-forge
inflection                0.5.1              pyh9f0ad1d_0    conda-forge
intervaltree              3.0.2                      py_0    conda-forge
ipykernel                 6.2.0            py38h595d716_0    conda-forge
ipython                   7.26.0           py38h595d716_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
isort                     5.9.3              pyhd8ed1ab_0    conda-forge
jedi                      0.18.0           py38haa244fe_2    conda-forge
jinja2                    2.11.3             pyh44b312d_0    conda-forge
jinja2-time               0.2.0                      py_2    conda-forge
jpeg                      9d                   h8ffe710_0    conda-forge
jsonschema                3.2.0              pyhd8ed1ab_3    conda-forge
jupyter_client            6.1.12             pyhd8ed1ab_0    conda-forge
jupyter_core              4.7.1            py38haa244fe_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
keyring                   23.1.0           py38haa244fe_0    conda-forge
lazy-object-proxy         1.6.0            py38h294d835_0    conda-forge
libclang                  11.1.0          default_h5c34c98_1    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libspatialindex           1.9.3                h39d44d4_4    conda-forge
markupsafe                1.1.1            py38h294d835_3    conda-forge
matplotlib-inline         0.1.2              pyhd8ed1ab_2    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
mistune                   0.8.4           py38h294d835_1004    conda-forge
mypy_extensions           0.4.3            py38haa244fe_3    conda-forge
nbclient                  0.5.4              pyhd8ed1ab_0    conda-forge
nbconvert                 6.1.0            py38haa244fe_0    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
nest-asyncio              1.5.1              pyhd8ed1ab_0    conda-forge
numpydoc                  1.1.0                      py_1    conda-forge
openssl                   1.1.1k               h8ffe710_1    conda-forge
packaging                 21.0               pyhd8ed1ab_0    conda-forge
pandoc                    2.14.1               h8ffe710_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
paramiko                  2.7.2              pyh9f0ad1d_0    conda-forge
parso                     0.8.2              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       21.0.1           py38haa95532_0
pluggy                    0.13.1           py38haa244fe_4    conda-forge
poyo                      0.5.0                      py_0    conda-forge
prompt-toolkit            3.0.19             pyha770c72_0    conda-forge
psutil                    5.8.0            py38h294d835_1    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pycodestyle               2.7.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pydocstyle                6.1.1              pyhd8ed1ab_0    conda-forge
pyflakes                  2.3.1              pyhd8ed1ab_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pylint                    2.7.2            py38haa244fe_0    conda-forge
pyls-spyder               0.4.0              pyhd8ed1ab_0    conda-forge
pynacl                    1.4.0            py38h31c79cd_2    conda-forge
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyqt                      5.12.3           py38haa244fe_7    conda-forge
pyqt-impl                 5.12.3           py38h885f38d_7    conda-forge
pyqt5-sip                 4.19.18          py38h885f38d_7    conda-forge
pyqtchart                 5.12             py38h885f38d_7    conda-forge
pyqtwebengine             5.12.1           py38h885f38d_7    conda-forge
pyrsistent                0.17.3           py38h294d835_2    conda-forge
pysocks                   1.7.1            py38haa244fe_3    conda-forge
python                    3.8.11               h6244533_1
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-lsp-black          1.0.0              pyhd8ed1ab_0    conda-forge
python-lsp-jsonrpc        1.0.0              pyhd8ed1ab_0    conda-forge
python-lsp-server         1.2.1              pyhd8ed1ab_0    conda-forge
python-slugify            5.0.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
pywin32                   301              py38h294d835_0    conda-forge
pywin32-ctypes            0.2.0           py38haa244fe_1003    conda-forge
pyyaml                    5.4.1            py38h294d835_1    conda-forge
pyzmq                     22.2.1           py38h09162b1_0    conda-forge
qdarkstyle                3.0.2              pyhd8ed1ab_0    conda-forge
qstylizer                 0.2.1              pyhd8ed1ab_0    conda-forge
qt                        5.12.9               h5909a2a_4    conda-forge
qtawesome                 1.0.3              pyhd8ed1ab_0    conda-forge
qtconsole                 5.1.1              pyhd8ed1ab_0    conda-forge
qtpy                      1.10.0             pyhd8ed1ab_0    conda-forge
regex                     2021.8.3         py38h294d835_0    conda-forge
requests                  2.26.0             pyhd8ed1ab_0    conda-forge
rope                      0.19.0             pyhd8ed1ab_0    conda-forge
rtree                     0.9.7            py38h8b54edf_2    conda-forge
setuptools                52.0.0           py38haa95532_0
six                       1.16.0             pyh6c4a22f_0    conda-forge
snowballstemmer           2.1.0              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sphinx                    4.1.2              pyh6c4a22f_1    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_0    conda-forge
spyder                    5.1.1            py38haa244fe_0    conda-forge
spyder-kernels            2.1.0            py38haa244fe_0    conda-forge
sqlite                    3.36.0               h2bbff1b_0
testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
text-unidecode            1.3                        py_0    conda-forge
textdistance              4.2.1              pyhd8ed1ab_0    conda-forge
three-merge               0.1.1              pyh9f0ad1d_0    conda-forge
tinycss2                  1.1.0              pyhd8ed1ab_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.1              pyhd8ed1ab_0    conda-forge
tornado                   6.1              py38h294d835_1    conda-forge
traitlets                 5.0.5                      py_0    conda-forge
typed-ast                 1.4.3            py38h294d835_0    conda-forge
typing_extensions         3.10.0.0           pyha770c72_0    conda-forge
ujson                     4.0.2            py38h885f38d_0    conda-forge
unidecode                 1.2.0              pyhd8ed1ab_0    conda-forge
urllib3                   1.26.6             pyhd8ed1ab_0    conda-forge
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
watchdog                  2.1.3            py38haa244fe_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.37.0             pyhd3eb1b0_0
win_inet_pton             1.1.0            py38haa244fe_2    conda-forge
wincertstore              0.2                      py38_0
wrapt                     1.12.1           py38h294d835_3    conda-forge
yaml                      0.2.5                he774522_0    conda-forge
yapf                      0.31.0             pyhd8ed1ab_0    conda-forge
zeromq                    4.3.4                h0e60522_0    conda-forge
zipp                      3.5.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h62dcd97_1010    conda-forge
```

</details>

This looks like an installation issue because no one else has reported this problem with such an small list. Please create a new environment and try again:

    conda create -n py37 -c conda-forge python=3.7 spyder
    conda activate py37
    spyder
Hi, I reinstalled Sypder 5 with the commands from above, but the problem still persists. Following packages are installed:

<details>

```
# Name                    Version                   Build  Channel
alabaster                 0.7.12                     py_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
argcomplete               1.12.3             pyhd8ed1ab_2    conda-forge
argh                      0.26.2          pyh9f0ad1d_1002    conda-forge
arrow                     1.1.1              pyhd8ed1ab_0    conda-forge
astroid                   2.5.8            py37h03978a9_0    conda-forge
async_generator           1.10                       py_0    conda-forge
atomicwrites              1.4.0              pyh9f0ad1d_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
autopep8                  1.5.7              pyhd8ed1ab_0    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
bcrypt                    3.2.0            py37hcc03f2d_1    conda-forge
binaryornot               0.4.4                      py_1    conda-forge
black                     21.7b0             pyhd8ed1ab_0    conda-forge
bleach                    4.0.0              pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py37hcc03f2d_1001    conda-forge
ca-certificates           2021.5.30            h5b45459_0    conda-forge
certifi                   2021.5.30        py37h03978a9_0    conda-forge
cffi                      1.14.6           py37hd8e9650_0    conda-forge
chardet                   4.0.0            py37h03978a9_1    conda-forge
charset-normalizer        2.0.0              pyhd8ed1ab_0    conda-forge
click                     8.0.1            py37h03978a9_0    conda-forge
cloudpickle               1.6.0                      py_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
cookiecutter              1.7.3              pyh6c4a22f_0    conda-forge
cryptography              3.4.7            py37h20c650d_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
debugpy                   1.4.1            py37hf2a7229_0    conda-forge
decorator                 5.0.9              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
diff-match-patch          20200713           pyh9f0ad1d_0    conda-forge
docutils                  0.17.1           py37h03978a9_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
flake8                    3.9.2              pyhd8ed1ab_0    conda-forge
icu                       68.1                 h0e60522_0    conda-forge
idna                      3.1                pyhd3deb0d_0    conda-forge
imagesize                 1.2.0                      py_0    conda-forge
importlib-metadata        4.6.4            py37h03978a9_0    conda-forge
importlib_metadata        4.6.4                hd8ed1ab_0    conda-forge
inflection                0.5.1              pyh9f0ad1d_0    conda-forge
intervaltree              3.0.2                      py_0    conda-forge
ipykernel                 6.2.0            py37h4038f58_0    conda-forge
ipython                   7.26.0           py37h4038f58_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
isort                     5.9.3              pyhd8ed1ab_0    conda-forge
jedi                      0.18.0           py37h03978a9_2    conda-forge
jinja2                    2.11.3             pyh44b312d_0    conda-forge
jinja2-time               0.2.0                      py_2    conda-forge
jpeg                      9d                   h8ffe710_0    conda-forge
jsonschema                3.2.0              pyhd8ed1ab_3    conda-forge
jupyter_client            6.1.12             pyhd8ed1ab_0    conda-forge
jupyter_core              4.7.1            py37h03978a9_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
keyring                   23.1.0           py37h03978a9_0    conda-forge
lazy-object-proxy         1.6.0            py37hcc03f2d_0    conda-forge
libclang                  11.1.0          default_h5c34c98_1    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libspatialindex           1.9.3                h39d44d4_4    conda-forge
markupsafe                1.1.1            py37hcc03f2d_3    conda-forge
matplotlib-inline         0.1.2              pyhd8ed1ab_2    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
mistune                   0.8.4           py37hcc03f2d_1004    conda-forge
mypy_extensions           0.4.3            py37h03978a9_3    conda-forge
nbclient                  0.5.4              pyhd8ed1ab_0    conda-forge
nbconvert                 6.1.0            py37h03978a9_0    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
nest-asyncio              1.5.1              pyhd8ed1ab_0    conda-forge
numpydoc                  1.1.0                      py_1    conda-forge
openssl                   1.1.1k               h8ffe710_1    conda-forge
packaging                 21.0               pyhd8ed1ab_0    conda-forge
pandoc                    2.14.1               h8ffe710_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
paramiko                  2.7.2              pyh9f0ad1d_0    conda-forge
parso                     0.8.2              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       21.2.4             pyhd8ed1ab_0    conda-forge
pluggy                    0.13.1           py37h03978a9_4    conda-forge
poyo                      0.5.0                      py_0    conda-forge
prompt-toolkit            3.0.19             pyha770c72_0    conda-forge
psutil                    5.8.0            py37hcc03f2d_1    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pycodestyle               2.7.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pydocstyle                6.1.1              pyhd8ed1ab_0    conda-forge
pyflakes                  2.3.1              pyhd8ed1ab_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pylint                    2.7.2            py37h03978a9_0    conda-forge
pyls-spyder               0.4.0              pyhd8ed1ab_0    conda-forge
pynacl                    1.4.0            py37ha54c9ec_2    conda-forge
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyqt                      5.12.3           py37h03978a9_7    conda-forge
pyqt-impl                 5.12.3           py37hf2a7229_7    conda-forge
pyqt5-sip                 4.19.18          py37hf2a7229_7    conda-forge
pyqtchart                 5.12             py37hf2a7229_7    conda-forge
pyqtwebengine             5.12.1           py37hf2a7229_7    conda-forge
pyrsistent                0.17.3           py37hcc03f2d_2    conda-forge
pysocks                   1.7.1            py37h03978a9_3    conda-forge
python                    3.7.10          h7840368_100_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-lsp-black          1.0.0              pyhd8ed1ab_0    conda-forge
python-lsp-jsonrpc        1.0.0              pyhd8ed1ab_0    conda-forge
python-lsp-server         1.2.1              pyhd8ed1ab_0    conda-forge
python-slugify            5.0.2              pyhd8ed1ab_0    conda-forge
python_abi                3.7                     2_cp37m    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
pywin32                   301              py37hcc03f2d_0    conda-forge
pywin32-ctypes            0.2.0           py37h03978a9_1003    conda-forge
pyyaml                    5.4.1            py37hcc03f2d_1    conda-forge
pyzmq                     22.2.1           py37hcce574b_0    conda-forge
qdarkstyle                3.0.2              pyhd8ed1ab_0    conda-forge
qstylizer                 0.2.1              pyhd8ed1ab_0    conda-forge
qt                        5.12.9               h5909a2a_4    conda-forge
qtawesome                 1.0.3              pyhd8ed1ab_0    conda-forge
qtconsole                 5.1.1              pyhd8ed1ab_0    conda-forge
qtpy                      1.10.0             pyhd8ed1ab_0    conda-forge
regex                     2021.8.21        py37hcc03f2d_0    conda-forge
requests                  2.26.0             pyhd8ed1ab_0    conda-forge
rope                      0.19.0             pyhd8ed1ab_0    conda-forge
rtree                     0.9.7            py37h13cc57e_2    conda-forge
setuptools                57.4.0           py37h03978a9_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snowballstemmer           2.1.0              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sphinx                    4.1.2              pyh6c4a22f_1    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_0    conda-forge
spyder                    5.1.1            py37h03978a9_0    conda-forge
spyder-kernels            2.1.0            py37h03978a9_0    conda-forge
sqlite                    3.36.0               h8ffe710_0    conda-forge
testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
text-unidecode            1.3                        py_0    conda-forge
textdistance              4.2.1              pyhd8ed1ab_0    conda-forge
three-merge               0.1.1              pyh9f0ad1d_0    conda-forge
tinycss2                  1.1.0              pyhd8ed1ab_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.1              pyhd8ed1ab_0    conda-forge
tornado                   6.1              py37hcc03f2d_1    conda-forge
traitlets                 5.0.5                      py_0    conda-forge
typed-ast                 1.4.3            py37hcc03f2d_0    conda-forge
typing-extensions         3.10.0.0             hd8ed1ab_0    conda-forge
typing_extensions         3.10.0.0           pyha770c72_0    conda-forge
ucrt                      10.0.20348.0         h57928b3_0    conda-forge
ujson                     4.0.2            py37hf2a7229_0    conda-forge
unidecode                 1.2.0              pyhd8ed1ab_0    conda-forge
urllib3                   1.26.6             pyhd8ed1ab_0    conda-forge
vc                        14.2                 hb210afc_5    conda-forge
vs2015_runtime            14.29.30037          h902a5da_5    conda-forge
watchdog                  2.1.4            py37h03978a9_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
win_inet_pton             1.1.0            py37h03978a9_2    conda-forge
wrapt                     1.12.1           py37hcc03f2d_3    conda-forge
yaml                      0.2.5                he774522_0    conda-forge
yapf                      0.31.0             pyhd8ed1ab_0    conda-forge
zeromq                    4.3.4                h0e60522_0    conda-forge
zipp                      3.5.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h62dcd97_1010    conda-forge
```

</details>

Maybe this has to do with my previous Spyder 4 installations? Because I have observed another issue: The code editor was very slow when the option "Show code style warnings" was enabled. I could solve this by resetting the Spyder settings. But this did not solve the issue with the code explorer.

By the way, after installing Spyder 5, the layout of Spyder 4 is messed up. Maybe this is somehow related?

![spyder_4](https://user-images.githubusercontent.com/79669161/130368590-f94093cf-5b9f-4b26-a5d3-a279aee6209c.png)


> Hi, I reinstalled Sypder 5 with the commands from above, but the problem still persists

Sorry to hear that but I really don't know why you're having this problem (as I said, no one else has reported it).

> Maybe this has to do with my previous Spyder 4 installations?

If you're resetting your settings, then no.

> By the way, after installing Spyder 5, the layout of Spyder 4 is messed up. Maybe this is somehow related?

This shouldn't be the case if you install our 4.2.5 version (older versions have this problem).
This is strange, because I have tried this on 5 different computers (including one with a fresh Windows and Anaconda installation), and on each one of them the problem has occurred. What I have also observed: when running the example from above using Spyder 5.0.5, then everything works well, no lags occur.
@dalthviz, could you check if you get the same behavior on Windows? 
@ccordoba12 @andprosoft I was able to reproduce this on Windows with Spyder 5.1.1
Note: Testing a little bit more seems like Spyder 5.1.1 from the installer doesn't have this performance problem. Maybe this is related with some dependency version update?
Thanks @dalthviz for the confirmation. Do you observe the same problem with our Windows installer?
> Maybe this is related with some dependency version update?

It could be, yes. Could you compare the list of dependencies in your environment with the ones in the installer to see which ones are different?

For that, please use an environment with conda-forge (and check first if you can also reproduce the problem there) because its packages are much more up to date.

@ccordoba12 some of the dependencies which version changed when checking a dependencies diff (using the copy to clip board from the dependencies dialog):

- keyring
- pygments
- pylint
- qtpy
- watchdog
- zmq

Zmq is the most probable culprit here. What are the installer and your env versions?
With the installer is `22.2.0`, with `conda-forge` is `22.2.1`
Ok, could you downgrade to `22.2.0` in your env and try again?
If that doesn't work, please also downgrade to `22.1.0` because there are some important changes for Windows in `22.2`:

https://github.com/zeromq/pyzmq/blob/main/docs/source/changelog.rst
@ccordoba12 after checking more seems like the performance is better if I install `matplotlib` `numpy` and `pandas` (changing the `zmq/pyzmq` version didn't do much from what I could see).

@andprosoft could you try to install along Spyder `matplotlib` `numpy` and `pandas`? Let us know if that improves the performance :)
Ok, that's great feedback @dalthviz! It probably means that this problem is related to the changes I did in PR #15857.
Maybe the lazy loading is slowing the rendering of the data when using the `CollectionsDelegate`? Something like retrying to import the modules each time a GUI update is being done?
> Something like retrying to import the modules each time a GUI update is being done?

Yeah, it could be something like that. I'll check to see if I can fix it in 5.1.2.

In addition, after uninstalling Pandas, Numpy and Scipy from my environment, I can also reproduce this problem on Linux.
@ccordoba12 @dalthviz Thanks for investigating this issue. As suggested, I tried the following commands to install Spyder:

```
conda create -n py37 python=3.7
conda activate py37
conda install -c conda-forge matplotlib numpy pandas
conda install spyder
```

As expected, this improved the performance significantly. The variable explorer still seems to be a little bit slower than it was in Spyder 3, but is now much faster than before.

Resolving patch:
diff --git a/external-deps/spyder-kernels/setup.py b/external-deps/spyder-kernels/setup.py
--- a/external-deps/spyder-kernels/setup.py
+++ b/external-deps/spyder-kernels/setup.py
@@ -36,12 +36,13 @@ def get_version(module='spyder_kernels'):
 
 
 REQUIREMENTS = [
+    'backports.functools-lru-cache; python_version<"3"',
     'cloudpickle',
     'ipykernel<5; python_version<"3"',
     'ipykernel>=5.3.0; python_version>="3"',
     'ipython<6; python_version<"3"',
     'ipython>=7.6.0; python_version>="3"',
-    'jupyter-client>=5.3.4',
+    'jupyter-client>=5.3.4,<7',
     'pyzmq>=17',
     'wurlitzer>=1.0.3;platform_system!="Windows"',
 ]
@@ -91,6 +92,7 @@ def get_version(module='spyder_kernels'):
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
         'Topic :: Software Development :: Interpreters',
     ]
 )
diff --git a/external-deps/spyder-kernels/spyder_kernels/py3compat.py b/external-deps/spyder-kernels/spyder_kernels/py3compat.py
--- a/external-deps/spyder-kernels/spyder_kernels/py3compat.py
+++ b/external-deps/spyder-kernels/spyder_kernels/py3compat.py
@@ -258,6 +258,7 @@ def _print(*objects, **options):
     import string
     str_lower = string.lower
     from itertools import izip_longest as zip_longest
+    from backports.functools_lru_cache import lru_cache
 else:
     # Python 3
     getcwd = os.getcwd
@@ -265,6 +266,7 @@ def cmp(a, b):
         return (a > b) - (a < b)
     str_lower = str.lower
     from itertools import zip_longest
+    from functools import lru_cache
 
 def qbytearray_to_str(qba):
     """Convert QByteArray object to str in a way compatible with Python 2/3"""
diff --git a/external-deps/spyder-kernels/spyder_kernels/utils/misc.py b/external-deps/spyder-kernels/spyder_kernels/utils/misc.py
--- a/external-deps/spyder-kernels/spyder_kernels/utils/misc.py
+++ b/external-deps/spyder-kernels/spyder_kernels/utils/misc.py
@@ -10,7 +10,10 @@
 
 import re
 
+from spyder_kernels.py3compat import lru_cache
 
+
+@lru_cache(maxsize=100)
 def is_module_installed(module_name):
     """
     Simpler version of spyder.utils.programs.is_module_installed.


Test patch: