IBPCollectionViewCompositionalLayout icon indicating copy to clipboard operation
IBPCollectionViewCompositionalLayout copied to clipboard

Performance issue during scroll / always create new cell instances

Open DavidObfuscator opened this issue 6 years ago • 0 comments

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))

DavidObfuscator avatar Oct 09 '19 09:10 DavidObfuscator