mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-06 21:22:44 +00:00
[ASCollectionView] Prevent prefetching from being enabled to eliminate overhead. (#65)
Some apps explicitly enable this, which is counterproductive with ASDK.
This commit is contained in:
@@ -258,12 +258,12 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
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];
|
||||
@@ -2098,6 +2098,16 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
|
||||
#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)
|
||||
|
||||
Reference in New Issue
Block a user