From d65fe8b5fad29d79a324a0c49f1792df63b1d5f6 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Wed, 4 Jan 2017 13:30:23 -0800 Subject: [PATCH] Disable UICollectionView prefetching to improve scroll performance (#2861) --- AsyncDisplayKit/ASCollectionView.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 5473d591a9..9cafd08518 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -280,7 +280,15 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; { if (!(self = [super initWithFrame:frame collectionViewLayout:layout])) 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]; _rangeController = [[ASRangeController alloc] init];