Fix file info load batching to operations of 16 files at a time.

CQTexperiment
Chris Moeller 2016-06-29 22:13:32 -07:00
parent a1fab29749
commit 0d12f9e4e3
1 changed files with 4 additions and 6 deletions

View File

@ -455,11 +455,11 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
- (void)loadInfoForEntries:(NSArray *)entries
{
int processorCount = (int) [[NSProcessInfo processInfo] processorCount];
long batchCount = ([entries count] / 16) + ([entries count] % 16 ? 1 : 0);
NSMutableArray *array = [[NSMutableArray alloc] init];
int i;
long i;
for (i = 0; i < processorCount; ++i)
for (i = 0; i < batchCount; ++i)
{
[array addObject:[[NSMutableArray alloc] init]];
}
@ -469,10 +469,8 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
{
if ([pe metadataLoaded]) continue;
int processor = i % processorCount;
[[array objectAtIndex:i / 16] addObject:pe];
++i;
[[array objectAtIndex:processor] addObject:pe];
}
if (!i) return;