1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-13 00:29:14 +00:00

Don't repeat constant.

This commit is contained in:
Thomas Harte 2024-12-07 11:55:38 -06:00
parent 84ea04f61d
commit a6ba549b67

View File

@ -50,12 +50,19 @@ struct HitRate {
[items addObject:[path stringByAppendingPathComponent:diskItem]];
}
dispatch_apply(([items count] + 9) / 10, dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^(size_t iteration) {
const auto base = iteration * 10;
for(size_t index = base; index < base + 10 && index < [items count]; index++) {
static constexpr int BatchSize = 10;
dispatch_apply(
([items count] + BatchSize - 1) / BatchSize,
dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0),
^(size_t iteration) {
const auto base = iteration * BatchSize;
for(size_t index = base; index < base + BatchSize && index < [items count]; index++) {
NSString *const fullPath = [items objectAtIndex:index];
NSLog(@"Starting %@", fullPath);
const auto list = Analyser::Static::GetTargets(fullPath.UTF8String);
NSLog(@"Ending %@", fullPath);
if(list.empty()) {
return;
}