• 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: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
      • From: James Bucanek <email@hidden>
    • Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
      • From: Jens Alfke <email@hidden>
References: 
 >[__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast! (From: Matt Gough <email@hidden>)
 >Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast! (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Mysterious Snow Crash
  • Next by Date: Can I recompose the Carbon-based app to a Cocoa-based app?
  • Previous by thread: Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
  • Next by thread: Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
  • Index(es):
    • Date
    • Thread