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

Performance issue during scroll / always create new cell instances #120

Open
DavidObfuscator opened this issue Oct 9, 2019 · 0 comments

Comments

@DavidObfuscator
Copy link

DavidObfuscator commented Oct 9, 2019

Hi,
i have performance issues with the IBPUICollectionViewCompositionalLayout.

During the scroll, the IBPUICollectionViewCompositionalLayout's layoutAttributesForElementsInRect method always ask data source for the cell, if we use estimated item size and item contentInsets.

the documentation / comments says:
contentInsets are ignored for any axis with an .estimated dimension
which is not ignored, makes the performance really bad.

Even if the collectionView's dequeueReusableCell method are used, it creates a new instance of the cell (and run the layouting)

Issue is on iOS 12, there is no any unwanted cell creation or performance issue on iOS 13

how to reproduce:
use estimated item height in Examples/ListViewController2:
change:
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))
to:
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .estimated(10.0))

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

No branches or pull requests

1 participant