Reduce cleverness

This commit is contained in:
Adlai Holler
2016-11-29 16:27:33 -08:00
parent 3fe87ffb64
commit 98ef8c00de

View File

@@ -1231,12 +1231,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
return @[];
}
// This is a very hot path of code. Since the return value is (in current versions of iOS) already mutable,
// skip making the extra copy when possible.
NSMutableArray *visibleIndexPaths = (NSMutableArray *)self.indexPathsForVisibleRows;
if ([visibleIndexPaths classForCoder] != [NSMutableArray class]) {
visibleIndexPaths = [visibleIndexPaths mutableCopy];
}
NSMutableArray *visibleIndexPaths = [self.indexPathsForVisibleRows mutableCopy];
[visibleIndexPaths sortUsingSelector:@selector(compare:)];