Re: Cocoa optimization
Re: Cocoa optimization
- Subject: Re: Cocoa optimization
- From: "Timothy J. Wood" <email@hidden>
- Date: Wed, 9 Nov 2005 07:21:11 -0800
On Nov 9, 2005, at 1:55 AM, David Hendrix wrote:
Where the Objective-C app would do either:
char buffer[80];
sprintf(buffer, "This is record %d of %d", currentIndex, limit);
NSString *foo = [NSString stringWithCString:buffer
encoding:NSASCIIStringEncoding];
or the more simple:
NSString *foo = [NSString stringWithFormat:@"This is record %d
of %d", currentIndex, limit];
The first of the two NSString versions seems to be slightly faster,
but not blindingly so.
Have you tried getting rid of the autoreleases? Create the string
with an -init... method, use it as you need and then send it a -
release, rather than letting your autorelease pool build up (since
you say you are doing this hundreds of thousands of times).
-tim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden