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

TerminalFi commented 3 years ago

Can you confirm this in safe mode ?

luke-j commented 3 years ago

@TheSecEng Confirmed it's still janky in safe mode. Safe mode improves performance very slightly but is still noticeably worse than ST3 - especially in the sidebar.

BenjaminSchaaf commented 3 years ago

"gpu_window_buffer": true has no effect in Sublime Text 4. Can you confirm that you are actually running ST4? Can you also share the exact hardware you're using and the OpenGL context information printed in the console for ST4.

luke-j commented 3 years ago

@BenjaminSchaaf I am definitely on ST4 - build 4107 (see below). Perhaps it was the restart after changing that setting that improved performance. I can confirm setting it to false again doesn't degrade performance any further.

startup, version: 4107 osx x64 channel: stable

OpenGL info:

OpenGL Context Information:
  GL API Version: 4.1 INTEL-16.1.12
  GLSL Version: 4.10
  Vendor: Intel Inc.
  Renderer: Intel(R) Iris(TM) Plus Graphics 655

Hardware info:

~> system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro15,2
      Processor Name: Quad-Core Intel Core i7
      Processor Speed: 2.8 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 8 MB
      Hyper-Threading Technology: Enabled
      Memory: 16 GB
      System Firmware Version: 1554.80.3.0.0 (iBridge: 18.16.14347.0.0,0)
Rapptz commented 3 years ago

I can reproduce this issue on Windows 10 with or without hardware acceleration enabled.

danilokleber commented 3 years ago

First thing I noticed when updated. On my setup it's more apparent when running Sublime Text in the 4K screen. In the Macbook's (Retina) it is way more fluid. I was guessing it was my old (2015) laptop but ST3 was fine on both screens. Also played with scroll and acceleration options for no different outcome.

deathaxe commented 3 years ago

Downloaded bootstrap-5 source and tried to scroll throught its JavaScript source. Yes it is very laggy (at least the first time).

LinuxOnTheDesktop commented 3 years ago

Additionally, and at least on Windows (or at least on my Windows system), ST4 is slower to start than ST3!

deathaxe commented 3 years ago

I noticed that, too. It must be something OS related. Both startup times and syntax test benchmarks.

ST4107 on Ryzen 5600X 32GB GTX 980 Win10 21H1 now takes 1.5s to start even an empty window! No project no file. ST4107 on Intel i7-9850H 32GB Intel UHD 630 Windows 10 1903 takes 0,5s.

Same with syntax tests. I noted benchmark times over time. While those keep unchanged on Windows 1903, they slowed down by 3 times on Windows 21H1. Usually my Ryzen was 30% faster than i7.

Even cloned the whole ST4 directory onto both machines to make sure setups are identical.

Same with scrolling performance. I haven't had any issues with my Ryzen in any file, but as of the latest update it got laggy sometimes.

jackyrx commented 3 years ago

Yes, I can reproduce the laggy case, even I think ST4 loads slower and not smooth if comparing with ST3 (main tools for me).

sweettyler commented 3 years ago

ST4 is laggy for me and the same thing mentioned in https://forum.sublimetext.com/t/sublime-renders-extremly-slow-on-nomachine/24154/15 and https://github.com/sublimehq/sublime_text/issues/1321

dangh commented 3 years ago

wow I can't believe it. I just download ST3 and scrolling with keyboard is super smooth. I literally switch to MacVim because of keyboard scroll is super janky in ST4 even in safe mode.

eclazi commented 3 years ago

Experiencing this but mainly with large files, about 160MB. Smaller files <10MB seem ok.

version: 4107 windows x64 channel: stable
...
OpenGL Context Information:
  GL API Version: 4.6.0 NVIDIA 462.59
  GLSL Version: 4.60 NVIDIA
  Vendor: NVIDIA Corporation
  Renderer: GeForce RTX 3070 Laptop GPU/PCIe/SSE2
startup time: 0.467242
first paint time: 0.467242

fps: 2.9 average: 1ms
fps: 3.3 average: 1ms
fps: 6.9 average: 3ms
fps: 0.5 average: 5ms
fps: 0.3 average: 3ms
fps: 2.8 average: 2ms
fps: 6.7 average: 3ms
fps: 2.9 average: 0ms
fps: 4.5 average: 1ms
fps: 2.9 average: 1ms
lsakiro commented 3 years ago

Hi, I'm also experiencing this.

Also, when I switch window back to ST4 from another application, sometimes there is a lag before the ST4 window renders. I did try to disable hardware rendering but the situation became much worse. ST3 has none of these issues.

Please fix soon and I will happily upgrade 🙂

wbond commented 3 years ago

I'm seeing the exact same behavior as @lsakiro, except my ATI is a 5500M instead of 5600M.

It seems to be reproduced by:

  1. Starting ST while my machine is plugged into an external display, causing the discrete (ATI) GPU to be used
  2. Unplugging my external display, resulting in the Intel GPU being used

When this happens, I often have various hangs when switching apps to ST, and also when selecting items and scrolling. If I close and restart ST to get the Intel GPU to show in the OpenGL debug info in ST.

I believe we had a similar bug to this in 10.14.5, or something like this with gpu_window_buffer and I think it had to do with the OpenGL context being shuffled through CPU memory when the GPU was switched while ST was open.

If I remember correctly, we had to detect GPU switches and recreate the OpenGL context. Perhaps this hasn't been implemented yet with the new OpenGL backend?

BenjaminSchaaf commented 3 years ago

Build 4108 has some fixes related to poor scrolling performance.

sweettyler commented 3 years ago

I do see some improvement (though not much) with Build 4109. However, the scrolling performance is still on the poor side for me (no hardware acceleration).

BenjaminSchaaf commented 3 years ago

@sweettyler I assume you're not on macOS then? If so then could you make a separate issue for that please.

sweettyler commented 3 years ago

@BenjaminSchaaf Thanks. Already reported in https://github.com/sublimehq/sublime_text/issues/4446.

lsakiro commented 3 years ago

@BenjaminSchaaf Thanks. -> There is significant improvement for me on Build 4109, however when compared to ST3 it is still noticeable for me in terms of smoothness. If I did not have ST3, I probably would accept it. But it's to be expected since ST3 has already set the bar quite high 😄 Best wishes,

LinuxOnTheDesktop commented 3 years ago

There is also, at least on Windows and ST build 4109, a noticeable and indeed inconveniencing delay between launch and the program - e.g. the find box - accepting input.

BenjaminSchaaf commented 3 years ago

@LinuxOnTheDesktop That sounds like a separate issue.

danilokleber commented 3 years ago

Unfortunately, for me, build 4113 does not improve the scrolling (indexing is also slower). But I'm guessing my machine is also showing some aging (6 years) as it's better on a lower resolution. Maybe I'll rollback to ST3.

Thanks anyways!

BenjaminSchaaf commented 3 years ago

@danilokleber What OS (and version) are you using and are you using hardware acceleration?

danilokleber commented 3 years ago

@BenjaminSchaaf I'm using macOS 11.4 on a MacBook Pro (Retina, 13-inch, Early 2015) with integrated Intel Graphics alongside a 4K display which is why I'm blaming the hardware. I can't tell any difference toggling hardware acceleration.

EDIT: if I size down the ST window I get a way better scrolling on the 4K display.

TerminalFi commented 3 years ago

So, disconnecting the 4K probably completely resolves the issue ?

danilokleber commented 3 years ago

@TheSecEng Just making the window smaller does it.

simonnier commented 3 years ago

I can not see any improvement on build 4113 with a file of size 8MB, though the changelog says "Improved performance when editing large files". My laptop is one of the latest, i7-11800H with RTX3070. So hardware should not be an issue. PS. notepad++ is very smooth.

rwols commented 3 years ago

@simonnier can you share this 8MB file somewhere?

simonnier commented 3 years ago

@rwols I share it here https://sharefast.me/5V3UERP. It is even more laggy with pgup/pgdn or arrow up/down press down . By the way, my screen resolution is 2560*1600

rwols commented 3 years ago

For what it's worth, I opened that file and scrolling is very smooth. Video: https://sharefast.me/QR

jfcherng commented 3 years ago

I can not see any improvement on build 4113 with a file of size 8MB, though the changelog says "Improved performance when editing large files". My laptop is one of the latest, i7-11800H with RTX3070. So hardware should not be an issue. PS. notepad++ is very smooth.

Does it happen in safe mode?

simonnier commented 3 years ago

@rwols safe mode is the same. Here is my screen capture video https://sharefast.me/CGLD36C . I forgot to mention that I am on win10

deathaxe commented 3 years ago

Runs very smooth here, too.

sublime.log_fps() shows

No matter, whether scrolling via mouse, dragging minimap or using pageup/pagedown keys.

OpenGL Context Information:
  GL API Version: 4.6.0 NVIDIA 466.27
  GLSL Version: 4.60 NVIDIA
  Vendor: NVIDIA Corporation
  Renderer: NVIDIA GeForce GTX 980/PCIe/SSE2

IMHO, rendering performance was improved in recent builts quite noticible. One of my benchmarking files is a large lemminx java file, which parses in 9ms but felt like taking ages to be displayed up to ST 4110. It now opens instantly.

Note power settings may impact rendering performance much especially on Notebooks. Using energy safing mode throttles down CPU/GPU power to pre-pentium age. My bussiness notebook i7-9580H With Quattro RTX3000 is bearly usable if it runs on battery. It feels like a 486 then.

simonnier commented 3 years ago

@deathaxe power setting is not playing the role here. I have a smooth notepad++, and the windows notepad is also very smooth for this file.

deathaxe commented 3 years ago

I don't think one can compare ST with Notepad or Notepad++. They are very old and more or less very simple apps. Notepad++ ran smooth on my AMD Athlon 20 years ago, and Notepad did on my Pentium 200Mhz. Notepad doesn't have any concept of syntax highlighting. It's just a simple win32 text control with a menubar.

But anyway all 3 apps run very smooth with your 8MB file here. Indeed Notepad flickers heavily while scrolling.

You could try to run "Plugin Development: Profile Events" from command palette to see whether any plugin executes an expensive synchronous event handler, which might slow down screen updates.

Did you try to run with opengl enabled or just default windows renderer?

simonnier commented 3 years ago

@deathaxe But the true is that I did not install any extra plugin. It is a fresh install. Viewing this file does not involve any syntax highlight either. I also tried setting "hardware_accelleration": "opengl", does not help.

deathaxe commented 3 years ago

With opengl enabled ST prints the used graphics card and driver version to console upon startup. Would you mind sharing it? Maybe this helps devs to narrow down the issue.

My first hunch is it using IntelHD graphics, which Windows nearly always does by default on notebooks. If that's the case you could try to force windows to render ST using your RTX3070. At least IntelHD graphics of my buissiness notebook struggles much with everything above fullHD in general.

see: https://windowsloop.com/set-nvidia-graphics-card-as-default-windows/

BenjaminSchaaf commented 3 years ago

What would also help is the output from sublime.log_fps(True).

simonnier commented 3 years ago

@BenjaminSchaaf Some output of log_fps

sublime.log_fps(True) fps: 2 average: 2ms fps: 32.4 average: 4ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 25ms Frame time exceeded 60hz: 26ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 31ms Frame time exceeded 60hz: 31ms Frame time exceeded 60hz: 25ms fps: 13.8 average: 16ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 28ms fps: 12.8 average: 13ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 26ms Frame time exceeded 60hz: 27ms fps: 11.5 average: 12ms Frame time exceeded 60hz: 26ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 30ms Frame time exceeded 60hz: 27ms Frame time exceeded 60hz: 26ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 28ms fps: 10.7 average: 18ms Frame time exceeded 60hz: 25ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 28ms Frame time exceeded 60hz: 28ms

simonnier commented 3 years ago

@deathaxe Just tried sublime text 3 portable version, everything is smooth! So I won't change my graphic card setting :)

deathaxe commented 3 years ago

I am really curious about what's the difference in running installed vs. portable version. Strange.

simonnier commented 3 years ago

@deathaxe I think you probably misunderstood me. I said portable sublime text 3 is smooth, but sublime text 4 is not smooth no matter it is portable or not.

deathaxe commented 3 years ago

Oversaw the 3, indeed. But that doesn't help finding the reason for those frame times. But as I see 1ms on all my notebooks I tend to blame graphics driver to perform poor.

BenjaminSchaaf commented 3 years ago

@simonnier Do you perhaps have other software running that could interfere? Something like antivirus, screen recording, etc?

simonnier commented 3 years ago

@BenjaminSchaaf I do not think so. Anyway, if something exists, why doesn't it interfere with sublime text 3?

BenjaminSchaaf commented 3 years ago

A lot of things have changed in ST4 and specifically some antivirus rely heavily on whitelists that may not include newer versions or the new name.

Otherwise does performance improve with a smaller window?

dangh commented 3 years ago

It happen for me on macOS too. Scrolling with mouse is not an issue but with keyboard it's terribly bad in ST4. It's even worse than VSCode or Atom.

luke-j commented 3 years ago

Just chiming in to say that 4113 has possibly a little better scrolling performance in a code tab, but similar or even worse performance to prior versions in the sidebar. Both are still noticeably less performant than ST3. Scrolling performance doesn't seem related to the size of the file for me. Most noticeably the first half second or so of scrolling is really poor, then it seems to get a little smoother until the scrolling stops.

humam2104 commented 3 years ago

WTF is this?! Did I pay 100$ for a program that scrolls slower than Notepad? This is bullshit