Sublime Forum

Sublime 4: scrolling not smooth

#6

I’m on Linux btw. Also changing the refresh rate of my monitor down to 60Hz increases the lag. On 144Hz seems much better, but still not ideal. Software rendering yields better results than the hardware one on my end.

Not entirely sure what a normal desktop processor have to refer to either. It’s the same CPU found in current gen Mac books (not A1). It is the Iris Plus one, same as the one shown in the docs, it’s just that it doesn’t use the same code name on Linux for some reason.

0 Likes

#7

I’m on Linux btw. Also changing the refresh rate of my monitor down to 60Hz increases the lag. On 144Hz seems much better, but still not ideal. Software rendering yields better results than the hardware one on my end.

Linux has had a similar vsync change.

Can you enable fps logging: sublime.log_fps(True) to confirm whether the actual frames are rendered quickly enough or if it’s a different problem?

0 Likes

#8

Yes, it seems that the hardware rendering is capped at 60 fps, that’s why I’m seeing better results with the software one.

with software rendering enabled:

ps: 102.6 average: 1ms
fps: 57.4 average: 1ms
fps: 15.9 average: 0ms
fps: 142.8 average: 1ms
fps: 115.9 average: 1ms
fps: 141.9 average: 1ms
fps: 89.8 average: 1ms
fps: 140 average: 1ms
fps: 84.9 average: 1ms
fps: 144.1 average: 2ms - when scrolling around
fps: 144.9 average: 1ms
fps: 138.9 average: 2ms
fps: 144.8 average: 1ms
fps: 144 average: 1ms
fps: 131.9 average: 1ms
fps: 87.4 average: 2ms
fps: 13.4 average: 0ms

with hardware rendering enabled:

fps: 14.4 average: 0ms
fps: 24.5 average: 3ms
fps: 14.4 average: 1ms
fps: 34.7 average: 4ms
fps: 14.5 average: 1ms
fps: 61.1 average: 1ms
fps: 54.6 average: 1ms
fps: 61 average: 1ms
fps: 56.5 average: 1ms
fps: 60.9 average: 2ms - when scrolling around
fps: 61 average: 3ms
fps: 61 average: 2ms
fps: 61 average: 2ms
fps: 58.3 average: 1ms
fps: 53.8 average: 1ms
fps: 61.1 average: 2ms
fps: 60.7 average: 2ms
fps: 44.3 average: 4ms
fps: 61 average: 1ms
fps: 20.2 average: 2ms
fps: 21.4 average: 3ms

Just to clarify I’m using the default scroll speed of 1.0 and the lag occurs only when the scroll animation changes speed. It’s noticeably laggy when it deaccelerates especially.

0 Likes

#9

I’d like to join the conversion to report my observations.

Recently, after latest ST4 4109 (dev channel) update I also noticed scrolling the editor is not smooth and a little jagged (with HWA, not tested with SW yet). After toggling a few suspected extensions as well as searched the web for some reported scroll jank causes, I managed to improve the jagged scroll with these changes:

  • Change the preference: set “show_git_status” to false
  • Toggle the minimap (hide it)
  • I use “Color Highlight” extension and it drawed the sample color as background at the value and at line gutter. If I turn off “highlight_values” at the extension settings, the scroll jank improve a lot.
  • I also use GitGutter extension and If I enable “show_line_annotation” (default), fps will degrade if I scroll pass the shadow line annotation which is only visible at my caret.

Edited: I forgot to report my system: It’s a MacBook Pro 2019 with macOS Big Sur 11.4 installed.

0 Likes

#10

GitGutter’s line annotation is added/updated only if caret is moved to another line and removed as soon as caret moves horizontally. It is not updated while scrolling. Thus degrated scrolling performance may be related with rendering performance of line annotations only.

0 Likes

#11

I noticed scrolling is super janky (as in completely unusable) lately with large selections. I’m on an M1 Air w/ latest build, "hardware_acceleration": "opengl" set, using an external HiDPI monitor, though the issue happens with just the native screen also.

If you select an area larger than the screen size it triggers the issue, and it gets much worse the larger the selection, to the point of making the app unresponsive on a 400k file.

I just realized after reading the comment above that turning off the minimap fixes performance immediately, so it appears to be from minimap rendering.

0 Likes

#12

This is fixed for me in build 4110. Thanks!

0 Likes

#13

Very bad scrolling on Win10 (21H1 19043.1151), logger shows high frame rate, but it looks like 60 Hz anyway on 240 Hz display :confused: It’s easy to compare scrolling here (web browser, forum) and sublime’s file or console (ctrl+shift+p). I can see text traces that really looks like 60 Hz rendering or even low. Hope it’ll be fixed further because it’s very annoying…

Sublime Text, stable channel, Build 4113

Btw the same for internal sublime file explorer

0 Likes

#14

Unfortunately, I’m experiencing the very same issue on a 16" MacBook Pro. It is funny that this does not happen on my iMac, which also has a retina screen.

Both are running macOS Big Sur 11.4 (20F71) with Sublime 4113, Stable Channel. I don’t think installed packages are interfering, since having them installed or not does not affect the aforementioned behaviour, but for completeness sake, those are the packages currently installed:

  • BracketHighlighter
  • EditorConfig
  • Package Control

Logging FPS shows lots of complaints, along with a very low FPS (hardware_acceleration: none)

fps: 11.5 average: 4.87312e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31614e+08ms
Frame time exceeded 60hz: 5.31615e+08ms
Frame time exceeded 60hz: 5.31615e+08ms
Frame time exceeded 60hz: 5.31615e+08ms

Changing hardware_acceleration to opengl improves it, consistently yielding a higher FPS when scrolling:

fps: 70.6 average: 1ms
fps: 59.4 average: 1ms
fps: 23.8 average: 0ms
fps: 23.8 average: 0ms
fps: 23.9 average: 0ms
fps: 35.8 average: 1ms
fps: 68.2 average: 2ms -- began scrolling
fps: 82.2 average: 2ms
fps: 87.7 average: 3ms
fps: 61.7 average: 2ms
fps: 85.8 average: 2ms
fps: 77.4 average: 2ms
fps: 23.9 average: 0ms -- finished scrolling
fps: 23.9 average: 0ms
fps: 23.7 average: 0ms
fps: 22.8 average: 0ms
fps: 24.5 average: 0ms
fps: 33.7 average: 1ms
fps: 10.2 average: 1ms
fps: 15.5 average: 1ms
fps: 14 average: 1ms

Edit: Restarting Sublime Text seems to solve the issue for some time, until it needs restarting again. :frowning:

0 Likes

#15

I just updated to build 4121 and this is a great one, I displayed the FPS and I get consistent 144 fps now where I had more around 80 - 100 FPS before :slight_smile:

1 Like

#16

Came back to add that I still have the same problem on 4121. :frowning:
Now running Monterey 12.0.1 (21A559)
Also found another post that may be related:

Edit: It seems running ST4 on Full-screen mode makes it worse. When running as a window (pretty much the same size of full-screen, minus the Dock and Menubar size), I’m able to get 60+fps

0 Likes

#17

Can you provide another fps log from 4121? Note that with hw acceleration enabled, as it is by default, it didn’t look like you were getting any slowdowns before?

0 Likes

#18

On my end on Linux the default rendering still seems a bit better 4121. Also the hardware one is still capped on 60 fps. So sublime.log_fps(True) still yields the same output for both the hardware and the default one, around 2-3ms 60fps and 2-3ms for 144fps respectively. Though it seems that the scrolling got a bit smoother visually.

It still have some stuttering when it deaccelerates. I don’t know if you test/optimize for freescroll mouse. Last time I was testing with Logitech MX Anywhere 2, but since then I got the Logitech MX Anywhere 3 which have an even higher sensitivity on the scroll wheel. So I can scroll through thousands of lines of text with a single scroll movement, but this mode also makes the deaccelerate stuttering even more noticeable. Again my GPU is the Iris Plus 8th gen Intel, but on Ubuntu Linux, you can see it above in my previous comment.

0 Likes

#19

@bschaaf I recorded a short video on my desktop at 144fps. The format is .mkv so you may need VLC player to view it on a Mac.

Notice how the animation stutters when it deaccelerates. The hardware (the scroll wheel) spins freely up until the end. So I’m thinking that the issue is in how the software interprets that. I’m using the default "scroll_speed": 1.0.

NOTE: not using hardware_acceleration as that is capped on 60fps

0 Likes

#20

Free scroll wheels are still stepped in that a certain amount of rotation translates into individual scroll events. If the wheel is spinning slowly that means it will send a scroll event at a slower interval than it takes ST to animate the entire last scroll event, so you end up with “stutters”. The same should be happening for any other application.

Additionally I can’t reproduce high-refresh rate not working using hardware acceleration:

0 Likes

#21

I just recorded another video where you can clearly see that I have the hardware rendering enabled but it’s capped on 60fps when I’m scrolling. My monitor is running at 144Hz at the time of the recording. Also in my previous video you can see that with the software rendering it goes up to 144fps when I’m scrolling.

0 Likes

#22

We use the standard gtk_widget_add_tick_callback on Linux to schedule animations. If that’s not giving us the frame rate of the monitor then that seems like an issue with GTK or your desktop environment. I’m not getting the same behavior here so perhaps it’s already been fixed in a later version of GTK.

1 Like

#23

@bschaaf Sorry, I completely missed your last message.
Running 4126 Stable on Monterey, issue persists.

fps: 10.9 average: 0ms
fps: 16 average: 0ms
fps: 15.9 average: 0ms
fps: 15.9 average: 0ms
fps: 16.5 average: 1ms
fps: 14.9 average: 1ms
fps: 14 average: 1ms
fps: 14.9 average: 1ms
fps: 14.9 average: 1ms
fps: 15 average: 1ms
fps: 15 average: 1ms
fps: 42.9 average: 2ms  - began scrolling
fps: 39.9 average: 2ms
fps: 38.4 average: 2ms
fps: 38.3 average: 2ms
fps: 42.6 average: 2ms
fps: 41.3 average: 2ms
fps: 33.6 average: 2ms
fps: 14.9 average: 1ms  - stopped scrolling
fps: 14.9 average: 1ms
fps: 20 average: 1ms
fps: 25.7 average: 2ms
fps: 22.8 average: 2ms  - began scrolling
fps: 43.8 average: 2ms
fps: 41.6 average: 2ms
fps: 46.9 average: 2ms
fps: 38 average: 2ms
fps: 6.9 average: 3ms
fps: 26.6 average: 1ms
fps: 22.4 average: 1ms
fps: 48.9 average: 1ms
fps: 17.2 average: 1ms
fps: 8.8 average: 1ms   - stopped scrolling
fps: 25.7 average: 1ms
fps: 42.5 average: 1ms

Not sure whether this could be of any use, but here’s my settings:

{
	"theme": "Adaptive.sublime-theme",
	"font_size": 13,
	"fade_fold_buttons": true,
	"rulers": [75, 80],
	"translate_tabs_to_spaces": true,
	"caret_style": "smooth",
	"scroll_past_end": true,
	"draw_white_space": "all",
	"trim_trailing_white_space_on_save": "all",
	"trim_only_modified_white_space": false,
	"ensure_newline_at_eof_on_save": true,
	"default_line_ending": "unix",
	"drag_text": false,
	"show_tab_close_buttons_on_left": true,
	"hide_tab_scrolling_buttons": true,
	"hide_new_tab_button": true,
	"show_git_status_in_status_bar": false,
	"show_git_status": false,
	"ignored_packages":
	[
		"Vintage",
	],
}

Update: Disabling hardware acceleration makes it much more responsive…

Frame time exceeded 60hz: 4.064e+08ms
fps: 61 average: 3.99844e+08ms
Frame time exceeded 60hz: 4.064e+08ms

Those “Frame time exceeded” floods the log output, but when it prints the fps message, is always >= 60.

0 Likes

#24

Those frame times when using hardware acceleration show it’s rendering extremely quickly. Do you perhaps have a high-refresh-rate display? - currently animations are hard-coded to 60hz.

0 Likes

#25

Not really, just the MacBook display. I have since upgraded to an M1 MacBook, and haven’t had issues since :slight_smile:

0 Likes