title: iOS NSArray, NSSet versus Core Data Query (Fetch Request)
body: <p>My boss and I are trying to figure out what is the best way to handle data from core data and we are trying to figure out the pros and cons for two different ways of handling it. We are looking at the efficiency of the different methods.</p>
  
  <p>1) We store each table in the data model into an NSArray or NSSet and only make fetch requests when a row has been modified or has a row added to it. We then manipulate the NSArray and NSSets to what we need by filtering them with predicates. </p>
  
  <p>2) We set up the fetch request in the beginning to grab only the data that we need with compound predicates, and then go from there. </p>
  
  <p>We tested the timing between the two. Option 1) 0.000259 seconds
                                        Option 2) 0.000528 seconds</p>
  
  <p>We have a couple things we are thinking about as well. Option 1 seems to be faster however is that only because we are handling only about a couple hundred rows of data AND will we run into a memory issue if the arrays get way to big say we start hitting a million rows. </p>
  
  <p>We think option 2 should have been the faster one, but again is it slower just because there isn't enough data? AND will it run into a memory problem if there is a million rows?</p>
  
  <p>If you can explain why one will be more efficient than the other that will be greatly appreciated.  </p>