Reputation: 1407
Given this:
NSString *innerXml = @"somevalue";
NSMutableString *xml = [[NSMutableString alloc] init];
Which of these is faster; not asking about readability, which is subjective:
1.
[xml appendFormat:@"<randomElement>%@</randomElement>", innerXml];
2.
[xml appendString:@"<randomElement>"];
[xml appendString:innerXml];
[xml appendString:@"</randomElement>"];
Upvotes: 2
Views: 652
Reputation: 112857
If you are really curious about the implementation read the source code, it is available online, see: CFString.c.
Essentially the core foundation code is available as part of the opensourceing of the darwin kernel.
Upvotes: 1