Is running Parse getDataInBackgroundWithBlock:progressBlock: the same as creating a new thread using GCD?

I'm trying to improve the performance of my UICollectionView loading times. I am using Parse to store all of my data, and my question is whether or not I should even be considering using GCD in conjunction with Parse?

Currently, I am loading all images using:

getDataInBackgroundWithBlock:progressBlock:

However, I was wondering if I should use:

dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
dispatch_async(myQueue, ^{
    // Perform long running process

    dispatch_async(dispatch_get_main_queue(), ^{
        // Update the UI

    });
});

What are your thoughts on this?

Upvotes: 0

Views: 522

Answers (1)

Timothy Walters
Timothy Walters

Reputation: 16884

Parse methods already run on a background thread. What you need to be careful of is what you do in the completion block.

If you're doing anything non-trivial there, and that is causing your UI to lag, you could use another thread there in your completion block that does the extra processing and feeds back to the UI.

If it is just the load times you are worried about, look at the option of caching locally. Parse has options to check the local cache first.

Upvotes: 1

Related Questions