Skip to content
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

Significant framerate drop on 6X slowdown in chrome developer tools #423

Closed
antonioberetini opened this issue Dec 9, 2021 · 13 comments
Closed

Comments

@antonioberetini
Copy link

Issue Summary

Simulating slower CPU 4x and 6x drops framerate to pretty much unusable state

Current Behavior

Framerate on 6x slowdown goes down to 20 fps even when scroll is in stationary position

Expected Behavior

In stationary position framerate should be 60 fps, while in motion some degradation is okay but 10 or 20 fps is not good

Steps to Reproduce

Run the current demo from the website with chrome using 4x and 6x CPU slowdown under performance tab

@idiotWu
Copy link
Owner

idiotWu commented Dec 9, 2021

I am curious about how the simulator works. Actually, I just ran the demo on an iPhone 7 and did not see any framerate drops.

This library was initially developed to improve the scrolling performance on mobile devices in 2015. Since those devices performed well at that time, I do not think the performance will be a big issue as long as the size of the scrollable area is reasonable – do not wrap the whole page into a scrollbar like I did XD.

@antonioberetini
Copy link
Author

antonioberetini commented Dec 9, 2021 via email

@antonioberetini
Copy link
Author

Love the library I am just trying to be overly cautious before we implement it in or application since we are heavy with animations. I would love to be able to unify scroll behavior across all platforms we are targeting, iOs, Android, Windows and Web.

@idiotWu
Copy link
Owner

idiotWu commented Dec 9, 2021

I would suggest checking what Chrome does under the performance tab when 6x slowdown is applied.

Just checked it with the native scrolling and our one:

Native Scrollbar Smooth Scrollbar
image image

Maybe I can say our scrollbar is even faster? 🤣

@antonioberetini
Copy link
Author

How did you test this? Is it on Windows or?

@idiotWu
Copy link
Owner

idiotWu commented Dec 9, 2021

How did you test this? Is it on Windows or?

I ran the test on my MacBook Pro 2020 (13-inch, Intel i5-1038NG7) with a 4k display on macOS 12.0.1.

I compared the performance between the API page (native scrollbar) and the demo page (smooth scrollbar). Maybe the API page is too heavy to reach a high scrolling performance, but anyway, our scrollbar is fast enough I think 🤣.

@antonioberetini
Copy link
Author

On Windows, API page is getting 60 fps

@antonioberetini
Copy link
Author

Here is a video demonstrating both with 6x slowdown. FPS is fine but look at the actual rendering. Clearly in smooth scrollbar example visually frames are lost.

2021_12_09_15_52_36.mp4

@idiotWu
Copy link
Owner

idiotWu commented Dec 9, 2021

I think the framerate drops are basically due to the translate3d that we apply to the scrollbar container. As noted in the caveats:

What's worse, as the scrollable area grows, this plugin will consume a large amount of GPU resources, resulting in jittery scrolling.

The following profilings show that our scrollbar takes twice the time rendering as native scrollbars (both on the demo page), which may result in the framerate drops on modern devices, I guess. Meanwhile, it only takes 1/6 the time in painting compared to the native ones, which will improve the performance on old devices that come with slow repainting.

Native Scrollbar Smooth Scrollbar
image image

Since modern browsers have largely improved scrolling performance, I think it is better to use native scrollbars on large pages. (Actually, I am curious why people are still using this plugin 😂 .)

P.S. turning off the scrollbar monitor may slightly improve the performance.

@antonioberetini
Copy link
Author

antonioberetini commented Dec 9, 2021 via email

@antonioberetini
Copy link
Author

Question, is it possible to enable just the overscroling behavior with native inner scroller?

@idiotWu
Copy link
Owner

idiotWu commented Dec 10, 2021

Of course that's possible, see my old answer on stack overflow: https://stackoverflow.com/a/39616817/2369823

Maybe we can make such a plugin sometime?

@antonioberetini
Copy link
Author

antonioberetini commented Dec 10, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants