From 24bf9f9762e11a5b194c87e04f0dd88694567169 Mon Sep 17 00:00:00 2001 From: Patrick Strawderman Date: Mon, 21 Apr 2014 19:08:53 -0400 Subject: [PATCH] cache model.class.propertyKeys outside of loop avoids calling the propertyKeys class method for each iteration of the loop. --- Mantle/MTLModel.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mantle/MTLModel.m b/Mantle/MTLModel.m index 6cf332cc..2ef60fed 100644 --- a/Mantle/MTLModel.m +++ b/Mantle/MTLModel.m @@ -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]; }