Spyder: Editor sluggish on document diagnostics update

Created on 13 Jun 2020  路  35Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [x ] Searched the issues page for similar reports
  • [ x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [ x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)

Problem Description

On mac (macOS 10.15.5, in this case), the editor in spyder seems to be laggy and slow. Simple tests are fast typing - sometimes it takes seconds to fill all characters. Scrolling is also slow - the editor keeps on rolling for seconds after the wheel on the mouse stops until the "buffer" is worked on...
Autocomplete needs up to seconds to react. However, it does not seem to be autocorrect related since disable alls features in this class do not change anything - neither does styles like vertical lines...
All tests are on a 4k screen, different scalings tested. The UI seems to be responsive anyway.

What steps reproduce the problem?

  1. Start spyder on macOS and start typing in the editor (!not the console - that works fast!)

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

  • Spyder version: 4.1.3
  • Python version: 3.7.7
  • Qt version: 5.12.8
  • PyQt version: 5.12.3
  • Operating System name/version: macOS10.15.5 (Darwin 19.4.0)

Dependencies


# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.4.1 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.15.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.0.0 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.5.3 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.4 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
sphinx >=0.6.6                 :  3.1.0 (OK)
spyder_kernels >=1.9.1;<1.10.0 :  1.9.1 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  3.2.1 (OK)
numpy >=1.7                    :  1.18.5 (OK)
pandas >=0.13.1                :  1.0.4 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  None (OK)
Editor Bug

Most helpful comment

@dalthviz yes I can confirm that disabling just this option (leaving all the other features e.g. code completion, folding, etc) makes a huge improvement in usability.

One thing to note: a big source of slowdown comes with comment blocks """... """ The reason is that I enabled the "automatically insert closing quotes" which is usually quite helpful. But for docstrings, because 3 quotes are needed, there's always a bit of deleting and re-entering to get the requisite 6 total quotes.

During that time, the editor seems to want to re-lint the whole file, so for example if I have 1k lines of text and I edit a docstring at the top of the file, that moment when I have the un-terminated block comment creates this hiccup where suddenly the whole file is a string, and then it's not, etc.

Anyway thank you @mrclary and @dalthviz for all the support!

All 35 comments

On mac (macOS 10.15.5, in this case), the editor in spyder seems to be laggy and slow. Simple tests are fast typing - sometimes it takes seconds to fill all characters. Scrolling is also slow - the editor keeps on rolling for seconds after the wheel on the mouse stops until the "buffer" is worked on...

  • Are you editing Python files or other kind of files? For other files we're working on a solution for those lags that will be available in Spyder 5.
  • If you're editing Python files, do you have the outline pane displayed? That's the main source of lags in the editor at the moment.

Autocomplete needs up to seconds to react. However, it does not seem to be autocorrect related since disable alls features in this class do not change anything - neither does styles like vertical lines...

  • It seems you're editing very long files. If that's the case, you're right to nothe that code completion takes some time to be displayed. But we'll improve that in 4.1.4 (to be released in a couple of weeks) and 4.2.0 (to be released in a couple of months).

All tests are on a 4k screen, different scalings tested. The UI seems to be responsive anyway.

We don't have access to 4k screens, so if that's the final culprit I'm afraid we don't a way to improve the situation.

Could you run spyder --reset in a terminal and try again with a clean configuration, to see if the problem is due to your 4k screen?

Pinging @mrclary to see if he has seen the behavior reported by @max3-2 in macOS.

I'm leaving this one for you @goanpeca after this point. Just wanted to give my feedback.

  • Are you editing Python files or other kind of files? For other files we're working on a solution for those lags that will be available in Spyder 5.

Python files in this case.

  • If you're editing Python files, do you have the outline pane displayed? That's the main source of lags in the editor at the moment.

Usually I do. But with smallest test files with only few elements in the outline, the issue persists. Tested it without, same issue.

  • It seems you're editing very long files. If that's the case, you're right to nothe that code completion takes some time to be displayed. But we'll improve that in 4.1.4 (to be released in a couple of weeks) and 4.2.0 (to be released in a couple of months).

Long files make it worse. However a simple import numpy as np and then np. is slow. I have this on mac, but not on Windows.

We don't have access to 4k screens, so if that's the final culprit I'm afraid we don't a way to improve the situation.

I tested it with my notebook ("just" retina ~2.5k) and its way better (not gone all the way though..). So this might be a reason. Ill do some more testing this week.

Could you run spyder --reset in a terminal and try again with a clean configuration, to see if the problem is due to your 4k screen?

This made it better, too. After reset its faster. With reset and no 4K, its so far gone that ist close to not noticeable.

If this comes to to 4k - If we find some ways to track the slowdown I'm happy to help but I have to think where to start. I have some Qt-based UIs coded myself and they work flawless on 4k. However I have to admit they are nearly as complex as spyder UI-wise.

I noticed sluggishness while typing in the editor as well a few months ago, though I have not investigated to the extent that @max3-2 has. All I've tested is "fast typing", which means that I rapidly and randomly strike keys for a couple seconds and stop abruptly and observe that the editor will lag for nearly 20-30 characters. However, I've noticed this behavior _only_ in Python 3.7, _not_ Python 3.8, and this is true for both bootstrap and MacOS application. This is the reason why my pre-release of the MacOS application is built on Python 3.8.2.

  • I don't use the outline pane, but I'll test it with my Python 3.8.2 build
  • I have a MacBook Pro Retina screen and don't have a 4K screen.
  • I create 3.7.7 and 3.8.2 conda environments from the same requirements file, so it could be related to Python itself (3.7.7 vs 3.8.2, unlikely) or to some package build (py37 vs py38, more likely).

I just tried 3.8 and did some more testing.
3.8 does not change anything.
This is definitely a performance issue. I can trace the slowdown to either long files or large windows. Long files impair the performance even on small windows, long being 5000+. This is at least somewhat to expect.
Smaller files are sluggish if spyder runs in a large window on 4k, eg max size down to lets say 2/3 of the full res. The editor gets faster the smaller the window is. On approx. half the size, its barely noticeable. On quarter the size (FHD), I cannot notice the issue anymore.

...And to add some complexity: macOS display scaling makes it worse. So running at no-scaled 4k is better than running at a scaled monitor, even though "less" information is displayed.

@mrclary Can you try different settings of display scaling? If this impacts performance even on lower res I think this is a good direction to look..

Can you try different settings of display scaling? If this impacts performance even on lower res I think this is a good direction to look..

I can confirm that changing the "Set a custom high DPI scaling" dramatically affects the responsiveness of the editor. The attached GIF demonstrates a DPI scaling of 3. For comparison, it shows "rapid type" in both the editor and the console.

Screen Recording 2020-06-15 at 9 00 21 AM mov

Is there a way to measure typing responsiveness in a quantitative way? I don't know anything about emulating keyboard entries, or whether that would even reproduce the behavior, or whether that could be timed in some way...

I can confirm that changing the "Set a custom high DPI scaling" dramatically affects the responsiveness of the editor.

Great! Thanks a lot for the confirmation @mrclary!

The attached GIF demonstrates a DPI scaling of 3

I tried that on Linux and I didn't noticed any lag. How long is the file you're using?

I think this could be a problem with the Qt/PyQt versions we're requiring (5.9 in Anaconda and 5.12 in pip) and macOS 10.15. We'll try to update to the latest versions (5.15) soon to see if that fixes the issue.

I tried that on Linux and I didn't noticed any lag. How long is the file you're using?

I'm using Spyder's own spyder/plugins/ipythonconsole/utils/kernelspec.py which has only 211 lines, and no other files open.

I found no improvement with PyQt=5.12.3. FYI, I'm running MacOS 10.14.6.

Udated PyQt Environment

# packages in environment at /Users/rclary/anaconda3/envs/spy-dev-377:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12                   py37_0  
applaunchservices         0.2.1                      py_0  
appnope                   0.1.0                    py37_0  
argh                      0.26.2                   py37_0  
astroid                   2.4.0                    py37_0  
atomicwrites              1.4.0                      py_0  
attrs                     19.3.0                     py_0  
autopep8                  1.4.4                      py_0  
babel                     2.8.0                      py_0  
backcall                  0.1.0                    py37_0  
bcrypt                    3.1.7            py37h1de35cc_0  
blas                      1.0                         mkl  
bleach                    3.1.4                      py_0  
ca-certificates           2020.1.1                      0  
certifi                   2020.4.5.1               py37_0  
cffi                      1.14.0           py37hb5b8e2f_0  
chardet                   3.0.4                 py37_1003  
cloudpickle               1.4.1                      py_0  
coverage                  4.5.4            py37h1de35cc_0  
cryptography              2.9.2            py37ha12b0ac_0  
cycler                    0.10.0                   py37_0  
cython                    0.29.17          py37h0a44026_0  
dbus                      1.13.14              h517e14e_0  
decorator                 4.4.2                      py_0  
defusedxml                0.6.0                      py_0  
diff-match-patch          20181111                   py_0  
docutils                  0.16                     py37_0  
entrypoints               0.3                      py37_0  
expat                     2.2.6                h0a44026_0  
fastcache                 1.1.0            py37h1de35cc_0  
flake8                    3.8.2                      py_0  
flaky                     3.6.1                      py_0  
freetype                  2.9.1                hb4e5f40_0  
future                    0.18.2                   py37_0  
gettext                   0.19.8.1             h15daf44_3  
glib                      2.63.1               hd977a24_0  
gmp                       6.1.2                hb37e062_1  
gmpy2                     2.0.8            py37h6ef4df4_2  
icu                       64.2                 h6de7cb9_1    conda-forge
idna                      2.9                        py_1  
imagesize                 1.2.0                      py_0  
importlib-metadata        1.6.0                    py37_0  
importlib_metadata        1.5.0                    py37_0  
intel-openmp              2019.4                      233  
intervaltree              3.0.2                      py_0  
ipykernel                 5.1.4            py37h39e3cac_0  
ipython                   7.13.0           py37h5ca1d4c_0  
ipython_genutils          0.2.0                    py37_0  
isort                     4.3.21                   py37_0  
jedi                      0.17.0                   py37_0  
jinja2                    2.11.2                     py_0  
jpeg                      9d                   h0b31af3_0    conda-forge
jsonschema                3.2.0                    py37_0  
jupyter_client            6.1.3                      py_0  
jupyter_core              4.6.3                    py37_0  
keyring                   21.1.1                   py37_2  
kiwisolver                1.2.0            py37h04f5b5a_0  
lazy-object-proxy         1.4.3            py37h1de35cc_0  
libclang                  8.0.1                h770b8ee_1    conda-forge
libcxx                    4.0.1                hcfea43d_1  
libcxxabi                 4.0.1                hcfea43d_1  
libedit                   3.1.20181209         hb402a30_0  
libffi                    3.2.1                h0a44026_6  
libgfortran               3.0.1                h93005f0_2  
libiconv                  1.16                 h1de35cc_0  
libllvm8                  8.0.1                h770b8ee_0    conda-forge
libpng                    1.6.37               ha441bb4_0  
libsodium                 1.0.16               h3efe00b_0  
libspatialindex           1.9.3                h0a44026_0  
libtiff                   4.1.0                hcb84e12_0  
markupsafe                1.1.1            py37h1de35cc_0  
matplotlib                3.1.3                    py37_0  
matplotlib-base           3.1.3            py37h9aa3819_0  
mccabe                    0.6.1                    py37_1  
mistune                   0.8.4            py37h1de35cc_0  
mkl                       2019.4                      233  
mkl-service               2.3.0            py37hfbe908c_0  
mkl_fft                   1.0.15           py37h5e564d8_0  
mkl_random                1.1.0            py37ha771720_0  
mock                      4.0.2                      py_0  
more-itertools            8.2.0                      py_0  
mpc                       1.1.0                h6ef4df4_1  
mpfr                      4.0.1                h3018a27_3  
mpmath                    1.1.0                    py37_0  
nbconvert                 5.6.1                    py37_0  
nbformat                  5.0.6                      py_0  
ncurses                   6.2                  h0a44026_1  
nspr                      4.22                 h0a44026_0  
nss                       3.46.1               h2ca8224_0  
numpy                     1.18.1           py37h7241aed_0  
numpy-base                1.18.1           py37h6575580_1  
numpydoc                  0.9.2                      py_0  
olefile                   0.46                     py37_0  
openssl                   1.1.1g               h1de35cc_0  
packaging                 20.3                       py_0  
pandas                    1.0.3            py37h6c726b0_0  
pandoc                    2.2.3.2                       0  
pandocfilters             1.4.2                    py37_1  
paramiko                  2.7.1                      py_0  
parso                     0.7.0                      py_0  
pathtools                 0.1.2                      py_1  
pcre                      8.43                 h0a44026_0  
pexpect                   4.8.0                    py37_0  
pickleshare               0.7.5                    py37_0  
pillow                    7.1.2            py37h4655f20_0  
pip                       20.0.2                   py37_3  
pluggy                    0.13.1                   py37_0  
prompt-toolkit            3.0.4                      py_0  
prompt_toolkit            3.0.4                         0  
psutil                    5.7.0            py37h1de35cc_0  
ptyprocess                0.6.0                    py37_0  
py                        1.8.1                      py_0  
pycodestyle               2.6.0                      py_0  
pycparser                 2.20                       py_0  
pydocstyle                4.0.1                      py_0  
pyflakes                  2.2.0                      py_0  
pygments                  2.6.1                      py_0  
pylint                    2.5.2                    py37_0  
pynacl                    1.3.0            py37h1de35cc_0  
pyopenssl                 19.1.0                   py37_0  
pyparsing                 2.4.7                      py_0  
pyqt                      5.12.3           py37h2a560b1_0    conda-forge
pyqt5-sip                 4.19.18                  pypi_0    pypi
pyqtwebengine             5.12.1                   pypi_0    pypi
pyrsistent                0.16.0           py37h1de35cc_0  
pysocks                   1.7.1                    py37_0  
pytest                    4.6.2                    py37_0  
pytest-cov                2.8.1                      py_0  
pytest-faulthandler       1.6.0                    py37_0    spyder-ide
pytest-lazy-fixture       0.5.2                      py_0    spyder-ide
pytest-mock               3.1.0                      py_0  
pytest-ordering           0.6                        py_0  
pytest-qt                 3.2.1                      py_0    spyder-ide
python                    3.7.7           hc70fcce_0_cpython  
python-dateutil           2.8.1                      py_0  
python-jsonrpc-server     0.3.4                      py_0  
python-language-server    4.1.3+183.gf33f9a0b4           dev_0    <develop>
pytz                      2020.1                     py_0  
pyxdg                     0.26                       py_0  
pyyaml                    5.3.1            py37h1de35cc_0  
pyzmq                     18.1.1           py37h0a44026_0  
qdarkstyle                2.8.1                      py_0  
qt                        5.12.5               h1b46049_0    conda-forge
qtawesome                 0.7.0                      py_0  
qtconsole                 4.7.4                      py_0  
qtpy                      1.9.0                      py_0  
readline                  8.0                  h1de35cc_0  
requests                  2.23.0                   py37_0  
rope                      0.16.0                     py_0  
rtree                     0.9.4                    py37_1  
scipy                     1.4.1            py37h9fa6033_0  
setuptools                46.1.3                   py37_0  
sip                       4.19.8           py37h0a44026_0  
six                       1.14.0                   py37_0  
snowballstemmer           2.0.0                      py_0  
sortedcontainers          2.1.0                    py37_0  
sphinx                    3.0.3                      py_0  
sphinxcontrib-applehelp   1.0.2                      py_0  
sphinxcontrib-devhelp     1.0.2                      py_0  
sphinxcontrib-htmlhelp    1.0.3                      py_0  
sphinxcontrib-jsmath      1.0.1                      py_0  
sphinxcontrib-qthelp      1.0.3                      py_0  
sphinxcontrib-serializinghtml 1.1.4                      py_0  
spyder-kernels            1.9.1                    py37_0  
sqlite                    3.31.1               h5c1f38d_1  
sympy                     1.5.1                    py37_0  
testpath                  0.4.4                      py_0  
tk                        8.6.8                ha441bb4_0  
toml                      0.10.0           py37h28b3542_0  
tornado                   6.0.4            py37h1de35cc_1  
traitlets                 4.3.3                    py37_0  
typed-ast                 1.4.1            py37h1de35cc_0  
ujson                     1.35             py37h1de35cc_0  
urllib3                   1.25.8                   py37_0  
watchdog                  0.10.2           py37h1de35cc_0  
wcwidth                   0.1.9                      py_0  
webencodings              0.5.1                    py37_1  
wheel                     0.34.2                   py37_0  
wrapt                     1.11.2           py37h1de35cc_0  
wurlitzer                 2.0.0                    py37_0  
xz                        5.2.5                h1de35cc_0  
yaml                      0.1.7                hc338f04_2  
yapf                      0.28.0                     py_0  
zeromq                    4.3.1                h0a44026_3  
zipp                      3.1.0                      py_0  
zlib                      1.2.11               h1de35cc_3  
zstd                      1.3.7                h5bba6e5_0

I think this could be a problem with the Qt/PyQt versions we're requiring (5.9 in Anaconda and 5.12 in pip) and macOS 10.15. We'll try to update to the latest versions (5.15) soon to see if that fixes the issue.

Just forced 5.15 after installing spyder. Made the issue worse.

@max3-2, those are bad news but thanks for mentioning it.

pyqt                      5.9.2            py37h655552a_2
python                    3.7.7           hc70fcce_0_cpython
qt                        5.9.7                h468cd18_1
spyder                    4.1.3                    py37_0
spyder-kernels            1.9.1                    py37_0

OSX 10.15.5

I can second this issue. It seems the combination of long files (still all my files are <1k lines) and being open a long time exacerbates this. Now I typically write the code in a text editor, and then run in spyder to debug. I also restart every 30m or so.

I thought disabling the auto-high-DPI scaling fixed it, but it persists. It happens both when connected to a 4k monitor, as well as the MBP 16" display.

To give a little more insight here: Scaling in macOS is somewhat tricky. If a scaling is set that is not even divided, the OS first scales everything up, then down again, see attached image. TLDR: This is a basic performance issue with CPU and GPU connected. The only way for a clean fix would be a major performance improvement to spyder in general..

image

The only way for a clean fix would be a major performance improvement to spyder in general

I don't understand how to do that, given that I ran Spyder on Linux on a 2x scale factor and noticed no lags on performance.

@dalthviz, could you test what happens on Windows?

I'm not sure scaling is the culprit. It didn't seem to make a large difference (I assume "Normal" is the lowest-overhead setting?). Besides, all things considered, resampling an image in realtime seems to be a quite low-overhead operation unless I guess it's done in software?

What seems to help the most is disabling the following features:

  • Code completion
  • Code snippets
  • Go to definition
  • calltips
  • hover hints
  • Kite
  • Indent guides
  • code folding

I tried to be scientific about it, but I don't have an accurate metric of "lag" or way to measure it. But it would see the last two items (Indent guides, code folding) seemed to have the largest improvement. It's usable now at least...

Maybe profiling spyder could help to understand better the source of the lag.

The steps to do it are the following (maybe could be worthy to add this steps to the wiki @ccordoba12 ?):

  • Make sure you have the most up-to-date version of spyder
  • Disable "Single instance" in the preferences > general > advanced settings
  • Create a file with:
from spyder.app import start
start.main()
  • Profile with: Run > Profile (NOT regular run) (A new instance of Spyder appears)
  • Use the new spyder that appears. Try to use it for a short while (3 min or so) and only do what you think is slow. For example if you think key presses is laggy, spend 3 min typing gibberish in the editor. The idea is that if you repeat enough times, whatever is laggy will take a lot of time and will be noticeable in the profiling results. Then you can quit the new spyder.
  • When the new spyder successfully exited, you can save the profiling results.
  • These profiling results together with the exact version of spyder can help us understand what is slow. You can have a look yourself but they can be a bit hard to interpret.

Edit: The steps were defined by @impact27, pinging him just in case he has other suggestions in terms on the profiling process :)

But it would see the last two items (Indent guides, code folding) seemed to have the largest improvement

Thanks a lot for your input @colinww! About code folding, we decided to show it only when the user hovers over the folding panel. That way Spyder won't consume resources trying to repaint folding arrows all the time. This fix will be available in our 4.1.4 version, to be released next week.

About the indent guides, we'll try to improve their performance for 4.2.0 by painting them only for the visible portion of the screen.

It's usable now at least...

Another thing that introduces a lot of lagging is the Outline pane, specially for large files (i.e. more than 1000 lines of code). So, please close it if you have it visible right now.

Finally, if you can help us to profile Spyder with the instructions provided by @dalthviz above, it would be great.

And about the Outline pane, @andfoy is working right now to improve its performance significantly (see PR #13109).

@dalthviz has a good idea. If I might extend it to bootstrap and suggest using snakeviz for interactive visualization

(spy-dev) $ conda install snakeviz
(spy-dev) $ python -m cProfile -o ~/Documents/Python/spyder/spyder.profile bootstrap.py

Then, when finished playing with Spyder

(spy-dev) $ snakeviz ~/Documents/Python/spyder/spyder.profile

It opens in your browser and is fully interactive, so you can drill down into processes and see what's going on.

Screen Shot 2020-07-03 at 9 03 23 PM

I'm not familiar with bootstrap. I did some reading, it looks like I need to generate bootstrap.py from a configuration file.

Do you have any suggestions or can you provide the exact configuration of bootstrap I should run? Also, I only found flask-bootstrap available on conda-forge, does this mean I should install it with pip? In the past I've avoided using pip since it has always caused problems with anaconda updates.

I ran the earlier suggestion of profiling spyder within spyder. The testcase is very simple. I simply browsed the source code of CppHeaderParser : https://pypi.org/project/CppHeaderParser/
The file is lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py.

This is a nice long file which essentially kills the spyder editor. I'd estimate seeing the spinning pinwheel 80% of the time while browsing the file, even just scrolling. Pressing "Enter" e.g. a newline, or removing a quotation on a string, etc. All very slow.

spyder_profile_cpp_header_parser.Result.zip

@colinww , bootstrap.py is a file part of the Spyder git repository. This allows one to launch Spyder from one's local clone of the repository for testing purposes.

From your profile results, it looks like a prime suspect may be spyder.plugins.editor.utils.decoration which calls remove over 71 million times. Though, how that's related to screen resolution I don't know.

Screen Shot 2020-07-07 at 8 43 41 AM

Ah I see. Should I be running these tests on a specific branch of the repo, or is the release version ok? I can clone if necessary.

I think the screen resolution may exacerbate the issue, but it's definitely always there. I am running at 4k, with 3 parallel editor windows open to different files, but I was only interacting with a single panel the whole time. I had all the editor features enabled. Let me know if there are specific tests I should try. I can think of ~7-8 different feature bits I can enable/disable, so testing all exhaustively would be a bit much.

Ah I see. Should I be running these tests on a specific branch of the repo, or is the release version ok? I can clone if necessary.

@colinww, you're fine doing it the way you are. I just wanted to alert others to additional methods for profiling, especially if one wanted to compare the performance of two different commits. If you wanted to test different commits, you would need to clone to a local repo, checkout the desired commit, and run the profile on bootstrap.py as I described earlier.

Thanks @colinww and @mrclary for the feedback! taking into account the profile results (and with the help of the package suggest by @mrclary - awesome to navigate the results), seems like the source of the majority of lag is the option Underline errors and warnings.

@colinww could you check if disabling the option Underline errors and warnings improves the performance for you? (it is under the Source menu)

@dalthviz yes I can confirm that disabling just this option (leaving all the other features e.g. code completion, folding, etc) makes a huge improvement in usability.

One thing to note: a big source of slowdown comes with comment blocks """... """ The reason is that I enabled the "automatically insert closing quotes" which is usually quite helpful. But for docstrings, because 3 quotes are needed, there's always a bit of deleting and re-entering to get the requisite 6 total quotes.

During that time, the editor seems to want to re-lint the whole file, so for example if I have 1k lines of text and I edit a docstring at the top of the file, that moment when I have the un-terminated block comment creates this hiccup where suddenly the whole file is a string, and then it's not, etc.

Anyway thank you @mrclary and @dalthviz for all the support!

I wonder if we can limit the calls to re-lint. In completion and linting preferences there are several places to specify times related to completions, but I'm not sure what exactly they all do or how they affect performance.

  • Show completion detail after keyboard idle (ms)
  • Show automatic completions after keyboard idle (ms)
  • Time to wait for all providers to return (ms)

No timing is offered for linting. Compared to completions, users may prefer to have linting performed at a slower rate than completions, or even just on saving the document. Is it likely that linting is ocurring at a much _higher_ rate than completions? If we implemented similar timing constraints for linting, would that help? E.g. Re-lint after keyboard idle (ms)?

Do you have suggestions on how to profile an existing running spyder? I notice the editor becomes very very slow after a day of use. At that point I just have to restart. I actually don't mind this (the cpython program I'm working on crashes spyder much more frequently than that) but perhaps it would be useful for development to get insight into why this happens.

I already submitted pull request #13281 with a possible fix for this.

Hi @ccordoba12 , I downloaded Spyder 4.2.0, but I'm afraid this issue is still not resolved.

I've found that Spyder's editor typing is slow if:

  • I'm on macOS
  • I'm using Spyder on the MacBook Pro's built-in monitor or an external 4k monitor

But the issue goes away when I use an external 2k monitor (same MacBook Pro). And note this observation is true for both Spyder 4.1.4 and Spyder 4.2.0.

Sorry to hear that but we don't have a 4k monitor to test.

Was this page helpful?
0 / 5 - 0 ratings