New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Change update_all to update_current on editor changes #11010
Conversation
What do you mean? |
I can't see any reason for the need to update all the files except that it was done this way before. |
5862602
to
82a49bd
Compare
82a49bd
to
ceaebe6
Compare
@bcolsen, thanks a lot for your prompt response to solve this nasty problem! However, I think you could improve your solution a little bit by implementing @CAM-Gerlach's suggestion:
|
Thanks @ccordoba12 . I wasn't sure if was considered in scope here, so I only posted on the issue as opposed to potentially derailing the PR. |
How does a plugin know that it's visible? I think that we need to update the oe_data to get the code cell names for runcell. @impact27? I guess we would only need to update the data before the code cell execution. |
If I am not mistaken, the |
You can use the Line 385 in cfa90bf
|
ceaebe6
to
1a50712
Compare
I there is significant difference when the outline tree updating is disabled, but there is still something keeping it from being smooth. It's probably the syntax highlighting. I'll make another issues to track possible optimizations that could be made to the outliner's |
I'm not sure what the fast tests are doing. Should I add |
@CAM-Gerlach, could you test this one to see if it works for you as expected? Thanks! |
@ccordoba12 In work now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No errors etc. running this, and there is a major performance improvement when I tested on a 100-line file and a 3000-line file with and without this PR, with the same 40-50 files open as before. For the test, I used default/clean settings which means indent guides, otf completion, code style warnings, etc. are all disabled, to reduce the impact of other variables that might slow down the editor. Measuring lines modified/deleted (holding down Ctrl-D) per second and total measured time to delete 100 lines of the file, performance improvement/lag reduction is anywhere from 3x/67% to 2x/50%, showing substantial improvement even in the worse case.
100-line (test.py), outline explorer closed: 10.5 lines/s / 9.5 s (with PR); 3.4 lines/s / 28.9 s (without)
100-line (test.py), outline explorer open: 7.9 lines/s / 12.7 s (with PR); 3.4 lines/s / 29.1 s (without)
3000-line (mainwindow.py), outline explorer closed: 5.4 lines/s / 18.5 s (with PR); 2.4 lines/s / 41.6 s (without)
3000-line (mainwindow.py). outline explorer open: 4.6 lines/s / 21.7 s (with PR); 2.3 lines/s / 43.9 s (without)
For reference, if I do the exact same thing in the same file in Notepad++ (also with syntax highlighting, etc enabled), I get:
100-line file: 26.7 lines/s / 3.76 s; 3000-line file: 26.6 lines/s / 3.77 s
(With about 0.5 s being keyboard first-repeat delay, and it might well be deliberately limited).
For the 3000 line file it seems quite probable it was the syntax highlighter causing most of the slowness, since the great majority of the slowdown with the PR applied on the short vs. the long file was the was the comparatively large (1-2s) lags when the first or last line of a docstring """
was deleted and everything was rehighlighted. There's a good chance that fixing this would also fix the very similarly-behaved slowness that the indent guides cause, if it ultimately comes down to the same thing (the redraw blocking the main thread) as opposed to anything specific to them.
Thanks a lot @CAM-Gerlach for the comprehensive testing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @bcolsen!! Thanks a lot for it!
Description of Changes
This is more of a simple proof of concept
Removed update_all from activating on current editor changes.
Issue(s) Resolved
Fixes #10992
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: bcolsen