• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa optimization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Cocoa optimization (From: David Hendrix <email@hidden>)
 >Re: Cocoa optimization (From: j o a r <email@hidden>)
 >Re: Cocoa optimization (From: David Hendrix <email@hidden>)

  • Prev by Date: Spell Checker problem
  • Next by Date: CFPropertyListCreateFromXMLData() error
  • Previous by thread: Re: Cocoa optimization
  • Next by thread: Re: Cocoa optimization
  • Index(es):
    • Date
    • Thread