Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cache model.class.propertyKeys outside of loop
avoids calling the propertyKeys class method for each iteration
of the loop.
  • Loading branch information
kilink committed Apr 21, 2014
1 parent 92fda1c commit 24bf9f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Mantle/MTLModel.m
Expand Up @@ -184,8 +184,9 @@ - (void)mergeValueForKey:(NSString *)key fromModel:(MTLModel *)model {
}

- (void)mergeValuesForKeysFromModel:(MTLModel *)model {
NSSet *propertyKeys = model.class.propertyKeys;
for (NSString *key in self.class.propertyKeys) {
if (![model.class.propertyKeys containsObject:key]) continue;
if (![propertyKeys containsObject:key]) continue;

[self mergeValueForKey:key fromModel:model];
}
Expand Down

0 comments on commit 24bf9f9

Please sign in to comment.