sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
804 stars 39 forks source link

[ST4] Poor scrolling performance when compared with ST3 #4223

Closed luke-j closed 2 years ago

luke-j commented 3 years ago

Description

Scrolling performance has noticeably regressed since ST3 - especially within the sidebar. Scrolling now appears janky/choppy. Using "gpu_window_buffer": true helps improves scrolling performance within the editor window by about 70%, but does nothing for the sidebar. Disabling smooth scroll does nothing.

The command palette, goto anything panels & console all scroll smoothly in line with ST3 performance.

Steps to reproduce

  1. Open any project or file
  2. Scroll within the sidebar or when editing a file using a mac trackpad.
  3. Notice scrolling choppiness.

I'm not sure whether this only happens when using a trackpad or whether it also happens with other devices.

Expected behavior

Scrolling should be as it was in ST3

Actual behavior

Scrolling performance regression.

Environment

BenjaminSchaaf commented 3 years ago

To those chiming in, if you're having the same problem please provide actual information to help debug the issue: Platform, version, hardware, try safe mode, etc. Performance issues are high priority, but we can't fix them if we can't reproduce them.

humam2104 commented 3 years ago

Want some info? here: DxDiag.txt System Information.txt image image Are these enough for you?

BenjaminSchaaf commented 3 years ago

@humam2104 Does it happen in safe mode? What gets logged in the console if you enable fps logging (sublime.log_fps(True))?

humam2104 commented 3 years ago

Safe mode produces the same results. I'm using a 120hz display. I don't know how to use fps logging. Please send me an explanation for that.

BenjaminSchaaf commented 3 years ago

Under the menu View > Show Console you paste in sublime.log_fps(True) and it will log the fps in the opened console. If you make the window smaller does the performance improve?

humam2104 commented 3 years ago

I've copied the whole thing for you.


DPI mode: per-monitor v2 startup, version: 4113 windows x64 channel: stable SAFE MODE - overriding packages, state and cache paths executable: /D/Program Files/Sublime Text/sublime_text.exe application: /D/Program Files/Sublime Text working dir: /C/Users/Work packages path: /C/Users/Work/AppData/Roaming/Sublime Text (Safe Mode)/Packages state path: /C/Users/Work/AppData/Roaming/Sublime Text (Safe Mode)/Local zip path: /D/Program Files/Sublime Text/Packages zip path: /C/Users/Work/AppData/Roaming/Sublime Text (Safe Mode)/Installed Packages ignored_packages: ["Vintage"] generating syntax summary generating meta info summary pre session restore time: 2.25019 startup time: 2.37819 first paint time: 2.38919 reloading plugin Default.arithmetic reloading plugin Default.auto_indent_tag reloading plugin Default.block reloading plugin Default.colors reloading plugin Default.comment reloading plugin Default.convert_color_scheme reloading plugin Default.convert_syntax reloading plugin Default.copy_path reloading plugin Default.echo reloading plugin Default.exec reloading plugin Default.fold reloading plugin Default.font reloading plugin Default.goto_line reloading plugin Default.history_list reloading plugin Default.html_print reloading plugin Default.indentation reloading plugin Default.install_package_control reloading plugin Default.keymap reloading plugin Default.kill_ring reloading plugin Default.mark reloading plugin Default.new_templates reloading plugin Default.open_context_url reloading plugin Default.open_in_browser reloading plugin Default.pane reloading plugin Default.paragraph reloading plugin Default.paste_from_history reloading plugin Default.profile reloading plugin Default.quick_panel reloading plugin Default.rename reloading plugin Default.run_syntax_tests reloading plugin Default.save_on_focus_lost reloading plugin Default.scroll reloading plugin Default.set_unsaved_view_name reloading plugin Default.settings reloading plugin Default.show_scope_name reloading plugin Default.side_bar reloading plugin Default.sort reloading plugin Default.switch_file reloading plugin Default.symbol reloading plugin Default.transform reloading plugin Default.transpose reloading plugin Default.ui reloading plugin CSS.css_completions reloading plugin Diff.diff reloading plugin HTML.encode_html_entities reloading plugin HTML.html_completions reloading plugin ShellScript.ShellScript plugins loaded reloading python 3.3 plugin Package Control.1_reloader reloading python 3.3 plugin Package Control.2_bootstrap reloading python 3.3 plugin Package Control.Package Control Package Control: Not running package cleanup since bootstrapping is not yet complete reloading python 3.3 plugin 0_package_control_loader.00-package_control reloading settings Packages/User/Package Control.sublime-settings

sublime.log_fps(True) fps: 4.3 average: 4ms fps: 2.7 average: 5ms fps: 0.2 average: 3ms fps: 1.3 average: 2ms fps: 2 average: 5ms fps: 0.8 average: 3ms fps: 0.7 average: 3ms fps: 2.1 average: 2ms fps: 2 average: 1ms fps: 1.4 average: 2ms fps: 2 average: 2ms fps: 8.9 average: 3ms fps: 13.4 average: 1ms fps: 7.1 average: 1ms fps: 5.3 average: 3ms


EDIT: This^ was done in Safe Mode btw EDIT 2: Windowed more results in the same performance

BenjaminSchaaf commented 3 years ago

From those logs it doesn't look like ST is having any trouble rendering. Are those logs from when it's lagging while scrolling? Would you be able to provide a screen recording?

humam2104 commented 3 years ago

Here: https://user-images.githubusercontent.com/41898465/132789362-78510d1d-4f07-4fdc-ac8d-03d3866ce3d0.mp4 EDIT: File Size: 114 MB I used to work with files with a size of around 1.5 GB and the program was butter smooth.

humam2104 commented 3 years ago

There's no indexing running in the background by the way. image

BenjaminSchaaf commented 3 years ago

Does it happen for all files, only large files or only this specific file? I noticed that that file is in One Drive/Dropbox, does it happen if the file is outside of that? For reference here's a ~200MB file with syntax highlighting enabled and I'm not seeing that problem:

https://user-images.githubusercontent.com/2748981/132793282-8d6bc854-079f-4eb9-8c1b-9e0c90fb7511.mp4

humam2104 commented 3 years ago

I see, but that doesn't mean the problem doesn't exist. I've given you my laptop specs. I just downloaded and installed Sublime Text 3 to be used on the same files and everything was fine. The problem happened with 50 Mb or 1GB files.

BenjaminSchaaf commented 3 years ago

I see, but that doesn't mean the problem doesn't exist.

I'm well aware, but it does mean that it isn't a general problem instead being more specific to your setup. Does it also happen for small files <1MB? I noticed that that file is in One Drive/Dropbox, does it happen if the file is outside of that?

deathaxe commented 3 years ago

Scrolling on a 4k@60Hz screen feels not very smooth on my notebook (i7-9850H) when running on internal Intel® UHD Graphics 630, too, sometimes. When forcing ST to use Nvidea RTX3000 everything is very smooth. I have no trouble on my private box which has a NVidea GTX980 only. Everything is super fast.

If the quite recent Intel graphics card struggles, I guess such an old card from 3rd generagion would do even more as those are not quite fast. I am not aware of whether a 120Hz screen stresses graphics card as much as a 4k@60Hz screen though.

My old i5-4670k wasn't even able to produce smooth full-hd video rendering on TV using HDMI.

@humam2104 According to screenshots you are running ST4114 but the console log is from ST4113. Any difference between those two?

Did you try to set hardware_accelleration to opengl?

I found especially recent builds running much smoother with opengl enabled on Win21H1.

Have you tried to run ST on your integrated NVidea 630M?

humam2104 commented 3 years ago

I have just to copy the file into my desktop. Same result happened (100 MB). Sublime Text 3 ran perfectly with all file sizes. A 3 looks to be working fine.

humam2104 commented 3 years ago

Any updates?

wbond commented 3 years ago

@humam2104 I don’t think you are likely to see any updated until Sublime HQ can reproduce the issue.

My hunch is there is some sort of GPU performance bug with your GPU driver that is triggered by one of the Windows APIs that ST4 uses, which is likely slightly different than the APIs used by ST3.

humam2104 commented 3 years ago

@humam2104 According to screenshots you are running ST4114 but the console log is from ST4113. Any difference between those two? I think the v4113 is the regular one while 4114 is the developer version. The console looks to be the same for both.

Have you tried to run ST on your integrated NVidea 630M? My card is not GT630 but the GTX 670MX. And yes, it's already running there

humam2104 commented 3 years ago

I have found the solution for my issues!! The culprit was DPI Scaling. Mine was at 125%. The video shows that when I set the DPI Scaling to System (Enhanced) everything works perfectly. Although the text quality is bad. I hope the developers would fix this issue ASAP. It's really annoying to read text this way.

https://user-images.githubusercontent.com/41898465/133532071-caef1ed2-3a4f-46bd-aadd-d75b6da6cec9.mp4

humam2104 commented 3 years ago

Here's a video proving that Sublime Text 3 didn't have any problems with ALL 3 DPI Options. Sublime Text 4 has the issue.

https://user-images.githubusercontent.com/41898465/133533136-385fc77b-45d2-40e5-aa42-cecdfe565715.mp4

EDIT: I just realised I repeated the system (Enhanced) twice. Therefore, here's the third option (No DPI Scaling)

https://user-images.githubusercontent.com/41898465/133533466-54efd92d-f75a-4652-9769-641cab528d06.mp4

BenjaminSchaaf commented 3 years ago

I was able to reproduce this once, but it's not consistent and not as pronounced as it in your recordings. I'm not able to reproduce it by setting the scale to 125%.

humam2104 commented 3 years ago

I was able to reproduce this once, but it's not consistent and not as pronounced as it in your recordings. I'm not able to reproduce it by setting the scale to 125%.

Does this mean this issue would get attention or it just going to be ignored?

emilio-rti commented 3 years ago

Hey,

I've been observing this issue for some time now, even posted in the support forum, but somehow failed to isolate the conditions for reproduction.

If it helps, something I've noticed today is that the gutter seems to have a huge effect on scrolling performance in ST4. Files with no changes at all (I use Git on my codebases) scroll fine, while the more a file changes, more highlights the gutter has and slower it goes. This aligns with my experience of performance gradually degrading the more code I write.

of course setting "gutter": false yields a huge performance boost.

Edit: no need to fully disable the gutter, "mini_diff": false also does the trick.

I hope this helps!

sweettyler commented 3 years ago

As I mentioned in some other posts, I always suspect there are some unnecessary text redraw or the redraw areas are too large. This gutter stuff mentioned by @emilio-rti can be perfectly explained by this suspect.

humam2104 commented 2 years ago

I've tried both of these, nothing worked:

BenjaminSchaaf commented 2 years ago

@humam2104 Sounds like you're having a separate issue to most others here; the gutter rendering performance would be OpenGL related which is only enabled by default on macOS. I do have some possible culprits in mind for your issue, but a separately submitted issue would be appreciated.

BenjaminSchaaf commented 2 years ago

@humam2104 specifically it sounds like you're experiencing #4844.

franck-paul commented 2 years ago

I also had a slow scrolling problem with Big Sur until I unchecked the "automatically switch graphics card" option in the OS battery settings; and I think since the Big Sur version, the system occasionally switches to battery mode (even when plugged in) to save battery life.

Since I unchecked this setting the scrolling is as fast as with the previous version (ST3)

emilio-rti commented 2 years ago

I believe this is a largely underreported issue for users with discrete graphics chips, specially on MacOS. Those are much powerful and hence kind of "cover up" otherwise noticeable slowdowns.

Even with the gutter/mini_diff ideas from above, I still notice slow downs on my Intel Graphics Macbook Pro when the autocompletion (LSP / clangd) pops up.

sweettyler commented 2 years ago

I believe this is a largely underreported issue for users with discrete graphics chips, specially on MacOS. Those are much powerful and hence kind of "cover up" otherwise noticeable slowdowns.

couldn't agree more!

BenjaminSchaaf commented 2 years ago

Gutter rendering performance should be fixed in build 4115. If you're experiencing a non gutter rendering performance problem please open a separate issue with the relevant details.