title: Fastest Way to Filter on Multiple Predicates in Obj-C
body: <p>I am doing a lengthy filter quite often and would like to know if there is any difference in performance between the following methods, or if they are just a matter of style?</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@""];
  NSPredicate *blockPredicate = [NSPredicate predicateWithBlock:nil];
  NSCompoundPredicate *compoundPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[]];
  </code></pre>
  
  <p>I did find another post mentioning they were a matter of style, but it did not discuss <code>predicateWithBlock</code> or go into any detail of how these methods work.</p>
  
  <p>I have another question that is semi-related: is it faster to in-line the predicates passed into an NSCompoundPredicate, or is it the same speed as declaring them outside as variables and passing the variables in? i.e.</p>
  
  <pre><code>NSCompoundPredicate *cp = [NSCompoundPredicate andPredicateWithSubpredicates:
  @[[NSPredicate predicateWithFormat:""], [NSPredicate predicateWithFormat:""]];
  </code></pre>
  
  <p>or</p>
  
  <pre><code>NSCompoundPredicate *cp = [NSCompoundPredicate andPredicateWithSubpredicates:
  @[pred1, pred2]];
  </code></pre>
  
  <p>Any explanation on this would be greatly appreciated, thank you</p>