MRProgress
MRProgress copied to clipboard
Very bad performances using Progress Overlay
Using the Progress Overlay I get very bad performances.
A background function that took 7sec to perform before (XML parsing+CoreData querying), takes now up to 24 seconds.
In my case I create the Progress Overlay on the main thread then create the launch my function in a background thread.
Before using the progress overlay, I had a simple UIView with a UIActivityIndicatorView spinning and no performance problem.
Am I missing something or does it really worsen the performances that much ?
Here is a sample of my code.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
NSArray* filesToUpdate = [DataLoader checkUpdates];
if(filesToUpdate.count) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
self.progressOverlay = [MRProgressOverlayView showOverlayAddedTo:self.view animated:YES];
self.progressOverlay.titleLabelText = @"Mise à jour des données";
self.progressOverlay.tintColor = [UIColor colorWithRed:0.06 green:0.47 blue:0.73 alpha:1.f];
});
[DataLoader updateFiles:filesToUpdate];
self.dataLoader = [[DataLoader alloc] init];
[self.dataLoader loadRawDataIntoCoreData];
NSLog(@"Done");
} else {
NSLog(@"Nothing to update");
}
dispatch_async(dispatch_get_main_queue(), ^(void) {
[MRProgressOverlayView dismissOverlayForView:self.view animated:YES];
[self closeSplashScreen];
});
Your code looks fine as far as I can tell. Have you tried to profile the code using Instruments.app to see where the time is actually spent? On which platform / device did you run the app, when you had the worse performance?