spyder: Indent guides makes the Editor extremely slow on large files

Problem Description

I’ve isolated the primary source of the slowness I was reporting earlier: it appears to be due to the Indent Guides, as it vanishes with them disabled and reappears with them enabled (particularly after closing/reopening the file).

The lags are directly proportional to file length in my testing; essentially unnoticeable on a 60 line file; tolerable but annoying on a 600 line file, and positively glacial on a 3000 line file (mainwindow.py). Turning off all the “Auto”, showing blank spaces, wrap lines, CPU/memory usage and all introspection/analysis features made no difference.

What steps reproduce the problem?

  1. Enable indent guides
  2. Open mainwindow.py from the Spyder repo
  3. Observe the majestic spectacle of a glacier moving

Versions

  • Spyder version: 4.0.0.dev0 386403ed52
  • Python version: 3.7.2
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Windows 8.1

Dependencies

pygments >=2.0    :  2.3.1 (OK)
qdarkstyle >=2.6.4:  2.6.5 (OK)
sphinx >=0.6.6    :  1.8.4 (OK)
pyls >=0.19.0     :  0.21.5 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
pandas >=0.13.1   :  0.24.1 (OK)
numpy >=1.7       :  1.15.4 (OK)
sympy >=0.7.3     :  1.3 (OK)
cython >=0.21     :  0.29.4 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
IPython >=4.0     :  7.2.0 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
pylint >=0.25     :  2.2.2 (OK)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 18 (15 by maintainers)

Most upvoted comments

@ccordoba12 Pulling the latest master with #10782 applied and running PyLS 0.31.1, the latest available, the lag is still very bad with indent guides on, being only able to type 3.2 characters per second sustained even with one key on repeat over a 80 character, 0-indented line (300 ms per character), and there’s around a 1000 ms interaction lag on the first character or any other changes. When I turn indent guides off, I get almost exactly double the characters per second, 6.3, and less than half the first keystroke delay. If I then also disable linting, code style warnings, and real-time code completion (which isn’t triggering here, since there’s no idle delay), things only improve a modest amount, to 6.9 max characters typed per second, with about the same small but noticeable interaction delay. For reference, in other editors (e.g. Notepad++), the rate at which I can type is 40+ chars per second with no interaction delay, limited only by keyboard repeat rate.

I can’t find the original thread (not sure why I didn’t link it here) where I did a ton of benchmarks, but from what I recall, this is closely in line with my previous findings, and has major usability impacts.

do you see some Qt output like warnings or some sort of messages?

Nope, not on either platform.

could you check your level of CPU usage and tell us the behaviour you see of that metric?

Sure. All on clean prefs, averaged over all 8 threads:

No IG, Idle: 10-15% No IG, Scroll: 15-20% No IG, Typing: 20-25%

IG on, Idle: 15-20% IG on, Scroll: 20-25% IG on, Typing: 25-40%

The increase isn’t huge or consistent, but it does seem to be present.

Strange. I can repro it consistently with on the latest master in --safe-mode with clean prefs and just turning IG on and off, as tested just now. Its especially noticeable with two panes open; sometimes it makes the entire MainWindow UI lag. Sometimes scrolling is particularly slow and sometimes not so bad, but its particularly noticeable with typing (its hard to tell for sure in the GIF due to the low frame rate and being all scrolling, no apparent typing). I’ve also tested on my Fedora 28 Linux VM, and I see the same effect after enabling Indent Guides and closing and reopening the file; although its a little less dramatic past the innate slowness of the VM, typing and scrolling are still considerably less responsive with them enabled (though I don’t notice the same difference in key repeat rate, possibly since a redraw isn’t triggered every key, only every second or so).

I’m not on a blazing fast machine, but its an Ivy Bridge i7-3630QM with 4 cores/8 threads and nominally clocked at 2.4/3.4 (with a modest ~200 MHz manual downclock applied for power and thermal savings), and 24 GB DDR3-1600 RAM, a 850 Evo SSD and a GTX 670M.