Disable UICollectionView prefetching to improve scroll performance (#2861)

This commit is contained in:
Adlai Holler 2017-01-04 13:30:23 -08:00 committed by GitHub
parent 89d4193757
commit d65fe8b5fa

View File

@ -280,7 +280,15 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
{ {
if (!(self = [super initWithFrame:frame collectionViewLayout:layout])) if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
return nil; return nil;
// Disable UICollectionView prefetching.
// Experiments done by Instagram show that this option being YES (default)
// when unused causes a significant hit to scroll performance.
// https://github.com/Instagram/IGListKit/issues/318
if (AS_AT_LEAST_IOS10) {
self.prefetchingEnabled = NO;
}
_layoutController = [[ASCollectionViewLayoutController alloc] initWithCollectionView:self]; _layoutController = [[ASCollectionViewLayoutController alloc] initWithCollectionView:self];
_rangeController = [[ASRangeController alloc] init]; _rangeController = [[ASRangeController alloc] init];