• 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: NSEnumerator retaining objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSEnumerator retaining objects?


  • Subject: Re: NSEnumerator retaining objects?
  • From: j o a r <email@hidden>
  • Date: Wed, 9 Mar 2005 19:57:53 +0100

In the general case it doesn't matter at all. However, if you're creating lots and lots of objects (like more than 100.000 in one event loop), it does make a significant difference to try to avoid enumerators, autoreleased objects, et.c.

That said, you should not stop using these convenient objects / patterns for that reason alone. Always start with a problem description, and always follow up with a solid benchmark, before you even start to think about removing them to improve performance.

j o a r

On 2005-03-09, at 19.48, John Stiles wrote:

I must be missing something. How does [[myObj retain] autorelease] affect performance?
[myObj retain] incurs the overhead of:
objc_msgSend
retainCount++


[myObj autorelease] incurs the overhead of:
objc_msgSend
add one entry to the autorelease pool--it's unspecified how NSAutoreleasePool stores its entries but it is likely to be very fast


Later on when the event loop drains, you have the overhead of:
objc_msgSend
retainCount--
compare retainCount with zero (it's non-zero since it was retained above)


So it's not zero overhead, sure, but I honestly wouldn't expect any of this to affect real-world performance measurements. Certainly not enough overhead to generate this much list traffic.
So is there another performance implication I'm missing?

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >Re: NSEnumerator retaining objects? (From: James Bucanek <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: mmalcolm crawford <email@hidden>)
 >Re: NSEnumerator retaining objects? (From: John Stiles <email@hidden>)

  • Prev by Date: Re: NSEnumerator retaining objects?
  • Next by Date: Re: NSEnumerator retaining objects?
  • Previous by thread: Re: NSEnumerator retaining objects?
  • Next by thread: Re: NSEnumerator retaining objects?
  • Index(es):
    • Date
    • Thread