title: Loop optimization / CoreData optimization
body: <p>Is there any way to optimise the looping in array? I have 10,000 objects in array [arr], so loop will continue to 10k times I have to make relationship between CfgBarCodeMask and CfgBarCodeMaskDetails. It takes around 8 min. How to reduce this time?</p>
  
  <pre><code>NSArray *arr=[coreDataEngine  fetchObjectWithEntityName:@"CfgBarCodeMask" withPredicate:nil withSortDescriptor:nil error:nil ];
  NSString *predicateString = [NSString stringWithFormat:@"barCodeMaskId == $idVar"];
  NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString];
  
  [arr enumerateObjectsUsingBlock:^(CfgBarCodeMask *barcodeMask, NSUInteger idx, BOOL *stop) 
  {                
      NSDictionary *variables = @{ @"idVar" : barcodeMask.id1 };
  
      NSArray *destinationArray=
          [coreDataEngine fetchObjectWithEntityName:@"CfgBarCodeMaskDetail" 
                                      withPredicate:[predicate predicateWithSubstitutionVariables:variables] 
                                 withSortDescriptor:nil error:nil ];
  
      if ([destinationArray count] &gt;0 ) {
          [barcodeMask addMaskDetails:[NSSet setWithArray:destinationArray]];
      }           
  }];
  </code></pre>