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

Fix FPS drops when dragging scrollable content #1503

Merged
merged 6 commits into from
Aug 30, 2024

Conversation

ASalavei
Copy link
Collaborator

@ASalavei ASalavei commented Aug 20, 2024

Apply all scheduled effects after each interaction event so that they are applied synchronously.

Fixes: https://youtrack.jetbrains.com/issue/CMP-1644
Fixes: https://youtrack.jetbrains.com/issue/CMP-4438

Release Notes

Fixes - iOS

Fix frame drops when dragging scrollable content on iOS

@ASalavei ASalavei requested review from MatkovIvan and m-sasha August 20, 2024 06:52
@ASalavei ASalavei closed this Aug 20, 2024
@ASalavei ASalavei reopened this Aug 20, 2024
@ASalavei ASalavei closed this Aug 20, 2024
@ASalavei ASalavei reopened this Aug 20, 2024
@elijah-semyonov
Copy link

I think @igordmn also needs to have a look.

@@ -205,6 +206,7 @@ internal abstract class BaseComposeScene(
nativeEvent = nativeEvent,
button = button
)
recomposer.performScheduledEffects()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a failed test catch only the first scroll event in one frame.

We can remove it, as this behaviour is no longer needed and it is written based on maybe incorrect interpretation of pointerInput + awaitPointerEventScope.

A context why it was written:

In Jetpack Compose 1.0 we had very slow handling of a scroll event. Native systems on the other hand can send 20 events per frame, and it is much slower to handle 20 events instead of one. So we decided to handle only the first one, relying on coroutine dispatching inside pointerEvent.

Now we don't have such issues, I checked a heavy Lazy List, there are no difference in FPS/lag comparing to jb-main. If we decide in the future that we need some event filtering/batching, we should do it differently, not relying on pointerInput dispatching.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it, it needs to be merged for 1.7.0-beta01

@igordmn igordmn merged commit e769561 into jb-main Aug 30, 2024
5 of 6 checks passed
@igordmn igordmn deleted the andrei.salavei/fix-frame-drops branch August 30, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants