• 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: Fast enumeration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast enumeration


  • Subject: Re: Fast enumeration
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 22 Jul 2010 16:42:24 -0700

On Jul 22, 2010, at 16:37, Graham Cox wrote:

> On 23/07/2010, at 9:28 AM, Jonathon Kuo wrote:
>
>> If I use this to go backward through the array:
>>
>> for (_id in [array reverseObjectEnumerator]) {
>> }
>>
>> ...is it still considered 'fast' enumeration?
>
>
> Yes, NSEnumerator conforms to the fast enumeration protocol.

... although we don't know know (AFAIK) whether the NSEnumerator implementation is really "fast". (It could implement the protocol, but still retrieve objects one at a time with 'nextObject' internally. That would have similar performance to using NSEnumerator the old way, I think.)

My guess is that the NSEnumerator class has a generic implementation that isn't any faster, but that specific enumerators (such as NSArray, NSSet, NSDictionary, etc) really use the underying collection's fast implementation._______________________________________________

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

References: 
 >Fast enumeration (From: Charlie Dickman <email@hidden>)
 >Re: Fast enumeration (From: Quincey Morris <email@hidden>)
 >Re: Fast enumeration (From: Jonathon Kuo <email@hidden>)
 >Re: Fast enumeration (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Fast enumeration
  • Next by Date: Re: Deselect keyboard focus of an NSMatrix cell
  • Previous by thread: Re: Fast enumeration
  • Next by thread: LSUIElement vs applicationShouldTerminate:
  • Index(es):
    • Date
    • Thread