From 63dfb8a2270ff4bca7dd14b2c1dc9c7e04028169 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Wed, 9 Jun 2010 22:38:19 -0400 Subject: [PATCH] CPPredicate optimization: early out in failing AND expression. --- Foundation/CPPredicate/CPCompoundPredicate.j | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Foundation/CPPredicate/CPCompoundPredicate.j b/Foundation/CPPredicate/CPCompoundPredicate.j index 7ba504e6a..55cd1ed0b 100644 --- a/Foundation/CPPredicate/CPCompoundPredicate.j +++ b/Foundation/CPPredicate/CPCompoundPredicate.j @@ -189,6 +189,8 @@ var CPCompoundPredicateType; result = [predicate evaluateWithObject:object substitutionVariables:variables]; else result = result && [predicate evaluateWithObject:object substitutionVariables:variables]; + if (!result) + return NO; break; case CPOrPredicateType: if ([predicate evaluateWithObject:object substitutionVariables:variables])