Thanks to the respondents on this question (http://stackoverflow.com/questions/1396949/this-loop-is-very-slow-i-think-because-i-create-a-lot-of-intermediate-strings-h) I was able to speed up my code many orders of magnitude.
I think I can probably do a bit better though. Is it possible to avoid the creation of a bunch of NSString's here, and instead split the big NSString (routeGeom) into a bunch of char buffers and iterate through those?
I have never done any C programming, so if you know how to get this done, it would be much appreciated!
NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate];
NSString *routeGeom = [pieces objectAtIndex:1];
NSArray *splitPoints = [routeGeom componentsSeparatedByString:@"],["];
routePoints = malloc(sizeof(CLLocationCoordinate2D) * ([splitPoints count] + 1));
int i=0;
for (NSString* coordStr in splitPoints) {
char *buf = [coordStr UTF8String];
sscanf(buf, "%f,%f,", &routePoints[i].latitude, &routePoints[i].longitude);
i++;
}