lisawray / groupie

Groupie helps you display and manage complex RecyclerView layouts.
MIT License
3.66k stars 291 forks source link

RecyclerView + Groupie , Big Data Will Scroll Slow #440

Open zhangzong opened 1 year ago

zhangzong commented 1 year ago

Describe the bug Hello author. Thanks for your hard work on this project. I use this library on my project anywhere list It's very friendly to use.

but now. I use recyclerview + groupie+glide to load Pictures of Device。 when I scroll recyclerview , load data by page,every page load 60 pictures. load more than 800 pictuers. I found scroll is a little hard and recyclerview scroll is slow. when load all pictures(more than 1500) , if want to scroll to top of recyclerview is very hard.

every times update view with groupieAdapter.update() function after load data

I test below case:

  1. comment all code in bind() function in BindableItem file. This issue can reproduce.
  2. use same data load logic , and use recyclerview +ListAdapter(androidx.recyclerview.widget.ListAdapter). (same xml layout file) This issue not reproduce

To Reproduce Use RecyclerView + Groupie load big data(more than 1500)

Expected behavior scroll should be smooth and it's not stuck

Library version RecyclerView 1.1.0 Goupie 2.8.1

Additional context Add any other context about the problem here.

Zhuinden commented 1 year ago

Hello, in order to know what went wrong, we need to know what kind of items you are displaying in the adapter, and also if by chance your RecyclerView is in a NestedScrollView/ScrollView (it must not be) + nested scrolling must be enabled on the RecyclerView.

zhangzong commented 1 year ago

Hello, in order to know what went wrong, we need to know what kind of items you are displaying in the adapter, and also if by chance your RecyclerView is in a NestedScrollView/ScrollView (it must not be) + nested scrolling must be enabled on the RecyclerView.

Thanks for response. Below is my item file . class MyBindableItem constructor( val data: GalleryImage, var viewModel: MyViewModel ) : BindableItem(data.hashCode().toLong()) { }

I use recyclerview + groupie in Fragment. The layout structure is as follows: -- ---- ------</com.google.android.material.appbar.AppBarLayout> ------</androidx.recyclerview.widget.RecyclerView> ----</androidx.constraintlayout.widget.ConstraintLayout> --

zhangzong commented 1 year ago

use same data load logic , and use recyclerview + androidx.recyclerview.widget.ListAdapte(DiffUtil).
(same xml layout file)
[This issue not reproduce]

zhangzong commented 1 year ago

Hi @Zhuinden . Could you reproduce this issue on your side? if you need .I can upload gif or mov for easy check issue? or other information for your nescessary

Zhuinden commented 1 year ago

I could not repro this, I think there is a chance it is data.hashCode().toLong(). Have you tried CPU profiler to see where the flame chart spike is?