Re: objectEnumerator vs objectAtIndex
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