-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Performance issues(missing frames) on LazyColum #4438
Performance issues(missing frames) on LazyColum #4438
Comments
@elijah-semyonov, could you check it on your device, when you have time? If we have a visible input lag with |
Facing the same issue. The CPU consumption goes ~80% just with LazyColumn. |
I'll have a look |
Not related to performance, seems like a state update error, investigating further. IMG_4575.MOV |
Not related to this issue, sorry! But the scroll lag is visible. |
Facing the same issue... |
Facing the same issue, and when start screen recording the scroll behavior so smooth |
@m-sasha before your PR will be reviewed and merged, how can I patch the dependency for my project ? |
That would be difficult. Just wait for the first dev build after my PR is merged. |
@m-sasha thanks for your response |
Runs perfectly with the test at JetBrains/compose-multiplatform-core/pull/1260 but unfortunately the "visible jump" comes back when commenting out the |
@tipsypotato Not sure I understand. In my reproducer, the Can you post a reproducer where the jump is still visible? Is it only visible on iOS? Can you post a video? |
@m-sasha Thanks for reply
Yeah but we can also scroll it mannually. I did some further tests, the scrolling experience with LazyColumn is still far from Column when scrolling on a real iOS device, it happened both on iPhoneSE3 and iPhone13 while run perfectly on Android. Col-lazyCol.movreproducer code: @Composable
fun TestLazyColumn() {
Box(modifier = Modifier.fillMaxSize()) {
Row {
Column(
modifier = Modifier
.fillMaxHeight()
.weight(1f)
.verticalScroll(rememberScrollState())
) {
(0..100).forEach { index ->
Text(
"Column item $index",
style = TextStyle(fontSize = 30.sp),
modifier = Modifier.height(150.dp).fillMaxWidth().border(
width = 1.dp,
color = Color.Black
)
)
}
}
LazyColumn(
state = rememberLazyListState(),
modifier = Modifier.fillMaxHeight().weight(1f)
) {
items(100) { index ->
Text(
"LazyColumn item $index",
style = TextStyle(fontSize = 30.sp),
modifier = Modifier.height(150.dp).fillMaxWidth().border(
width = 1.dp,
color = Color.Black
)
)
}
}
}
}
} |
@elijah-semyonov I guess more investigation is needed. |
@m-sasha I'll have another look. |
I struggle to reproduce it on 11 Pro Max and 14 Pro after the fix. 11_pro_max.mov14_pro.mov |
I'm experiencing the same issue, along with an additional one. It will become apparent when you scroll up. |
@jnelle |
I think he means the list seems to scroll to a random far position sometimes. |
@elijah-semyonov In your second slomo video |
@tipsypotato |
@elijah-semyonov I'm facing the performance issues when I scroll down and also when I scroll up the list skips random positions. Here is the reproducible code: is UiState.Success -> {
LazyColumn(modifier = Modifier.padding(innerPadding)) {
items(count = (uiState as UiState.Success<MainFeedResponse>).data.clips.size) {
Card(
Modifier.fillMaxWidth(),
shape = RoundedCornerShape(16.dp),
) {
Image(
painter = rememberImagePainter(
(uiState as UiState.Success<MainFeedResponse>).data.clips[it].image
),
contentDescription = "image",
)
Text((uiState as UiState.Success<MainFeedResponse>).data.clips[it].title)
}
}
}
} You'll find the repository here: |
@jnelle |
@elijah-semyonov I'm also facing the performance (stutters) issues on my Pixel 6 Pro, but it could be possible that this is caused from debug build. But the scroll behavior is also wrong but not the same as one iOS. video_2024-04-23_12-15-43.mp4 |
@jnelle |
@elijah-semyonov It still happens with release build on iOS, the stutters are frequent and subtle, but still very noticeable compared to Column. Our project uses lots of LazyColumn, so it would be very appreciated if you could give it a further look! |
@tipsypotato Apart from the issues you've noticed on my slowmo video, do you see something else? I'm trying to figure out if it's yet another lazy-column bug that we are not aware of (like the initially reported one), or general performance issues, which we are already working on. |
@elijah-semyonov add the code below to LaunchedEffect(Unit) {
while (true) {
withFrameMillis {}
}
} |
@tipsypotato this code snippet makes me think that it's probably related to JetBrains/compose-multiplatform-core#1356 |
@MatkovIvan As JetBrains/compose-multiplatform-core#1356 is merged, any chance to have a try with a dev-release? |
@xinzhengzhang |
@MatkovIvan Looks like 0.0.0-jb-main-dev1635 doesn't work and still performs well under workaround #4438 (comment) |
OK, so my guess was wrong. |
This issue was my bad, I forgot to set the height for the Image which was inside the Box. |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
Describe the problem
Bad performance on LazyColum( There is no problem with using Colum ) and the content of the screen does not move with the hand (latency)
In both implementations, I used the Instruments tool Allocation and Animation Hitches and Time Profiler.
I also tried grab the metal profile. It's all subtle levels. It doesn't seem to be a gpu performance problem. I feel like it's still a cpu problem.
The data performance of the two methods is basically the same, but the actual touch is obviously felt with LazyColum jank.
Affected platforms
Select one of the platforms below:
Versions
Sample code
Video
https://drive.google.com/file/d/1pekBo5D5OI-rkMHCb7byMYbAnsdXcz_c/view?usp=share_link
Profiling data
https://drive.google.com/drive/folders/1yndeXWYojDAoYxiZoraq-HVajq0HbbcX?usp=share_link
The text was updated successfully, but these errors were encountered: