Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very bad performances using Progress Overlay #93

Open
JeanMeche opened this issue Mar 19, 2015 · 1 comment
Open

Very bad performances using Progress Overlay #93

JeanMeche opened this issue Mar 19, 2015 · 1 comment

Comments

@JeanMeche
Copy link

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];
        });
@mrackwitz
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants