Re: NSEnumerator retaining objects?
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