Iglistkit: White spacing on fast scrolling

Created on 29 Jun 2018  路  12Comments  路  Source: Instagram/IGListKit

New issue checklist

General information

  • IGListKit version: 3.4.0
  • iOS version(s): 11.4
  • CocoaPods/Carthage version: CocoaPods 1.5.3
  • Xcode version: 9.4 9F1027a
  • Devices/Simulators affected: all (tested on real: SE, X. simulators: 6, 6+, air 2)
  • Reproducible in the demo project? (Yes/No): Yes https://github.com/Showmax/IGListKitLag
  • Related issues: #680

Debug information

https://pastebin.com/9rTp5x3C

We using IGListKit on our new home screen. Recently we found issue with fast scrolling: cells don't appear on time, so user experience empty white rows.
Here video from example project:
https://github.com/Showmax/IGListKitLag/blob/master/lag_example.mp4
Here video from our app:
https://github.com/Showmax/IGListKitLag/blob/master/real_life_example.MP4

I was able to find similar issue #680, but it was related to different problem.

question

Most helpful comment

We solve this issue internally:

  • as mentioned in #1160 we update row adapter without animations (in our case items don't insert / delete often, and all item changes can be handled by item section controller)
  • we add additional distinctUntilChanged on our Rx data streams for less ui updates

@zhubofei feel free to close issue if you don't need any additional information. Thanks.

All 12 comments

yup , facing same issue with normal list as well (not nested)

if anyone found solution for this ???

@ManWithBear I would suggest check your sizeForItem first.

@zhubofei can you be more specific?
We have 2 hardcoded cell sizes: portrait and square. All items initially in portrait size, on item appearance we perform asset request, and based on loaded data switch to asset specific size (portrait or square). Data fetched in buffered batch, so on scroll should be loaded only initial and final items.

@ManWithBear I checked the code and it seems alright. Have you ever run the project on a device or only in a simulator? The simulator has performance issue from time to time especially on lower-end macs.

@zhubofei Yes, both projects (our and example) have issues on devices (tested on SE, 6, X)

@ManWithBear I have little time testing. But I do find that the white spacing only appears when you scroll past the first GREY cell and then quickly scroll back. So I suspect it's something to do with the colorProvider part instead of the ListKit. I suggest you look into that part once more. And if the problem still not solved I can get back to you by the end of the week when I have more free time.

Hm, I was searching information around issues and accidentally found #1160. Looks like it same issue.

We solve this issue internally:

  • as mentioned in #1160 we update row adapter without animations (in our case items don't insert / delete often, and all item changes can be handled by item section controller)
  • we add additional distinctUntilChanged on our Rx data streams for less ui updates

@zhubofei feel free to close issue if you don't need any additional information. Thanks.

@ManWithBear can you please explain your solution here , how you have integrated distinctUntilChanged

@iOSUser110 our view layer subscribed on items stream from viewModel layer.
While investigating this issue we found that adapter gets way more updates that need to. We decrease updates count by using distinctUntilChanged. I'm not sure that it's helped a lot, since lag still happened after this change.
Real dealbreaker was turning off animations on update:

adapter.performUpdates(animated: true, completion: nil) 
to
adapter.performUpdates(animated: false, completion: nil)

@ManWithBear if you鈥檙e getting a ton of updates quickly, I鈥檇 try fiddling with the coalescanceTime. We found 16ms is ideal in Instagram, and will be making that the default soon.

Sent with GitHawk

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shuhrat10 picture shuhrat10  路  3Comments

alexwillrock picture alexwillrock  路  3Comments

runmad picture runmad  路  3Comments

rnystrom picture rnystrom  路  3Comments

lucabartoletti picture lucabartoletti  路  3Comments