Archived Forum Post

Index of archived forum posts

Question:

Speed up fetch/send process?

Sep 02 '14 at 17:16

Hey, is there any way we can speed up the LOGIN, FETCH EMAILS, and SEND EMAIL process? It take at least 2-3 seconds per email, that is on 50mbps WiFi and not even on cellular.

Is there any tips to fasten all processes?

UPDATE:

CkoMessageSet *messageSet = [self Search:emailStatus bUid:YES]; //  Search ALL, UNSEEN or SEEN mail. We can choose to fetch UIDs or sequence numbers.
if (!messageSet) {
    // handle error
}

NSMutableArray *uidArray = [[NSMutableArray alloc] init];

int messageSetCount = [messageSet.Count intValue];
for (int i = 0; i < messageSetCount; i++) {
    [uidArray addObject:[messageSet GetId:[NSNumber numberWithInt:i]]];
}

//  Fetch single email per UID
NSUInteger uidArrayCount = [uidArray count];
for (int uid = 0; uid < uidArrayCount; uid++) {
    CkoEmail *email = [self FetchSingle:[NSNumber numberWithInt:[[uidArray objectAtIndex:uid] intValue]] bUid:YES];
    NSLog(@"  << GOT EMAIL >>");
}

2014-08-09 18:06:10.614 WeMail[8157:3607]   << GOT EMAIL >>
2014-08-09 18:06:11.911 WeMail[8157:3607]   << GOT EMAIL >>
2014-08-09 18:06:14.723 WeMail[8157:3607]   << GOT EMAIL >>
2014-08-09 18:06:17.764 WeMail[8157:3607]   << GOT EMAIL >>
2014-08-09 18:06:20.572 WeMail[8157:3607]   << GOT EMAIL >>

Answer

The problem was that I was saving the whole email object as well and this wasted time, not a good idea! Also all the if statements and loops and info saving to NSDictionary. So Just check that your code is as fast as possible, leave debug logging at debug etc ;)