From 2ab82f5995ada72533b7841872007a2918082cf8 Mon Sep 17 00:00:00 2001 From: Michael Schneider Date: Tue, 26 Apr 2016 10:40:35 -0700 Subject: [PATCH] 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 --- AsyncDisplayKit/Details/ASDataController.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AsyncDisplayKit/Details/ASDataController.mm b/AsyncDisplayKit/Details/ASDataController.mm index 9d8a2c81..b84adeda 100644 --- a/AsyncDisplayKit/Details/ASDataController.mm +++ b/AsyncDisplayKit/Details/ASDataController.mm @@ -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]; } } - }]; - }]; + } + } }]; }