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

[ASCollectionView] Prevent prefetching from being enabled to eliminate overhead. #65

Merged
merged 1 commit into from
Apr 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
return nil;

// Disable UICollectionView prefetching.
// Disable UICollectionView prefetching. Use super, because self disables this method.
// 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;
super.prefetchingEnabled = NO;
}

_layoutController = [[ASCollectionViewLayoutController alloc] initWithCollectionView:self];
Expand Down Expand Up @@ -2091,6 +2091,16 @@ - (void)layer:(CALayer *)layer didChangeBoundsWithOldValue:(CGRect)oldBounds new

#pragma mark - UICollectionView dead-end intercepts

- (void)setPrefetchDataSource:(id<UICollectionViewDataSourcePrefetching>)prefetchDataSource
{
return;
}

- (void)setPrefetchingEnabled:(BOOL)prefetchingEnabled
{
return;
}

#if ASDISPLAYNODE_ASSERTIONS_ENABLED // Remove implementations entirely for efficiency if not asserting.

// intercepted due to not being supported by ASCollectionView (prevent bugs caused by usage)
Expand Down