• 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: objectEnumerator vs objectAtIndex
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objectEnumerator vs objectAtIndex


  • Subject: Re: objectEnumerator vs objectAtIndex
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 16 Feb 2006 14:09:18 -0800


On Feb 16, 2006, at 1:45 PM, Marcos Trejo Munguia wrote:

Hi list:

Today a question came to my mind, which method for accessing NSArray elements is more efficient, objectEnumerator or objectAtIndex?

Thank you in advance.

objectAtIndex.

"The following table describes the NSArray methods that provide the basis for all NSArray's other methods; that is, all other methods are implemented in terms of these three. If you create a subclass of NSArray, you need only ensure that these base methods work properly. Having done so, you can be sure that all your subclass's inherited methods operate properly.

count ... objectAtIndex ... objectsNoCopy"

Assuming that the implementation matches the documentation (which might be a poor assumption), objectEnumerator should be implemented by using objectAtIndex. I would not expect the difference to be significant in either case. That would be close to the last place I would look when optimizing code.

Chuck

--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: objectEnumerator vs objectAtIndex
      • From: Mike Schrag <email@hidden>
References: 
 >objectEnumerator vs objectAtIndex (From: Marcos Trejo Munguia <email@hidden>)

  • Prev by Date: objectEnumerator vs objectAtIndex
  • Next by Date: Re: objectEnumerator vs objectAtIndex
  • Previous by thread: objectEnumerator vs objectAtIndex
  • Next by thread: Re: objectEnumerator vs objectAtIndex
  • Index(es):
    • Date
    • Thread