Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
- Subject: Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
- From: Graham Cox <email@hidden>
- Date: Thu, 24 Sep 2009 11:10:45 +1000
On 24/09/2009, at 9:15 AM, Jens Alfke wrote:
On Sep 23, 2009, at 2:27 PM, Matt Gough wrote:
NSEnumerator *iter = [myMutableArray objectEnumerator];
while (syncInfo = [iter nextObject]) {
... Do some stuff
}
That's not a fast enumerator; that's the old-fashioned slow
enumerator.
I thought that NSEnumerator was implemented in terms of fast
enumeration "underneath" - the docs seem to imply that, as does the
existence of __NSFastEnumerationEnumerator private class. It may be
still slower than directly using the fast enumeration syntax, but
isn't there some gain to be had? I have hundreds of these enumeration
loops and I still need to support 10.4; I thought I was getting *some*
benefit automagically from fast enumeration on 10.5+
Also, wouldn't methods such as -makeObjectsPerformSelector:withObject:
and CFArrayApplyFunction(...) gain some benefit from fast enumeration?
I use these a lot too.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden