ios - NSMutableString appendString vs appendFormat, which is more efficient? -
given this:
nsstring *innerxml = @"somevalue"; nsmutablestring *xml = [[nsmutablestring alloc] init];
which of these faster; not asking readability, subjective:
1.
[xml appendformat:@"<randomelement>%@</randomelement>", innerxml];
2.
[xml appendstring:@"<randomelement>"]; [xml appendstring:innerxml]; [xml appendstring:@"</randomelement>"];
if curious implementation read source code, available online, see: cfstring.c.
essentially core foundation code available part of opensourceing of darwin kernel.
Comments
Post a Comment