Move to fast enumeration for iterating through an array

We move from block based enumeration for the array to fast enumeration as from a benchmark perspective this is faster. For the dictionary we stay with block based enumeration as looking up the value for the key in e.g. fast enumeration would be slower as using the block based API where we get the key and value for passed in
This commit is contained in:
Michael Schneider
2016-04-26 10:40:35 -07:00
parent 32f35d9d54
commit 2ab82f5995

View File

@@ -991,9 +991,9 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
- (void)dealloc
{
ASDisplayNodeAssertMainThread();
[_completedNodes enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray *nodes, BOOL *stop) {
[nodes enumerateObjectsUsingBlock:^(NSMutableArray *section, NSUInteger sectionIndex, BOOL *stop) {
[section enumerateObjectsUsingBlock:^(ASCellNode *node, NSUInteger rowIndex, BOOL *stop) {
[_completedNodes enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray *sections, BOOL *stop) {
for (NSArray *section in sections) {
for (ASCellNode *node in section) {
if (node.isNodeLoaded) {
if (node.layerBacked) {
[node.layer removeFromSuperlayer];
@@ -1001,8 +1001,8 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
[node.view removeFromSuperview];
}
}
}];
}];
}
}
}];
}