spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.25k stars 1.6k forks source link

Editor decorations are not removed sometimes #15295

Open ok97465 opened 3 years ago

ok97465 commented 3 years ago

Hi,

Spyder is slowing down over time. While trying to find out the cause, I found something strange. I don't know if this is related to slowing down, but I want to let you know. If it is intended, I will close the issue later.

I put "print(f'Number of decorators:{len(self._decorations)}')" at line 85 of the code below.

https://github.com/spyder-ide/spyder/blob/b50e20f5e7c35f60ab401011842f9afa20d74326/spyder/plugins/editor/utils/decoration.py#L85-L87

I think decorators are not removed sometimes.

zombie_decorators

What steps will reproduce the problem?

  1. Enable 'Underline errors and warnings'
  2. Type python code including warning or error(ex. a = 5 is 5)
  3. Hit arrow_key, arrow_down key repeatedly

Thank you.

spyder : master

Mandatory:

atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 4.0.0 (OK) cloudpickle >=0.5.0 : 1.6.0 (OK) cookiecutter >=1.6.0 : 1.7.2 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree >=3.0.2 : 3.1.0 (OK) IPython >=7.6.0 : 7.22.0 (OK) jedi =0.17.2 : 0.17.2 (OK) jsonschema >=3.2.0 : 3.2.0 (OK) keyring >=17.0.0 : 22.3.0 (OK) nbconvert >=4.0 : 6.0.7 (OK) numpydoc >=0.6.0 : 1.1.0 (OK) parso =0.7.0 : 0.7.0 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.8.0 (OK) pygments >=2.0 : 2.8.1 (OK) pylint >=1.0 : 2.7.4 (OK) pyls >=0.36.2;<1.0.0 : v5.0.0a4+745.gb50e20f5e.dirty (OK) pyls_black >=0.4.6 : 0.4.6 (OK) pyls_spyder >=0.3.2 : 0.3.2 (OK) qdarkstyle =3.0.2 : 3.0.dev (OK) qstylizer >=0.1.10 : 0.1.10 (OK) qtawesome >=1.0.2 : 1.0.2 (OK) qtconsole >=5.0.3 : 5.0.3 (OK) qtpy >=1.5.0 : 1.9.0 (OK) rtree >=0.8.3 : 0.9.7 (OK) setuptools >=39.0.0 : 52.0.0.post20210125 (OK) sphinx >=0.6.6 : 3.5.3 (OK) spyder_kernels >=2.0.1;<2.1.0 : 3.0.0.dev0 (NOK) textdistance >=4.2.0 : 4.2.0 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3;<2.0.0 : 1.0.2 (OK) xdg >=0.26 : 0.27 (OK) zmq >=17 : 20.0.0 (OK)

Optional:

cython >=0.21 : 0.29.22 (OK) matplotlib >=2.0.0 : 3.3.4 (OK) numpy >=1.7 : 1.19.2 (OK) pandas >=1.1.1 : 1.2.4 (OK) scipy >=0.17.0 : 1.6.2 (OK) sympy >=0.7.3 : 1.8 (OK)

ccordoba12 commented 3 years ago

Spyder is slowing down over time

Thanks for investigating that @ok97465. I've also noticed it but I don't know the cause yet.

I think decorators are not removed sometimes.

The problem is we update decorations with a timer, to avoid slowing down the editor too much while doing that. In other words, we don't remove decorations all the time, but only after a certain timeout (10 miliseconds right now).

And that could be the cause of what you're seeing.