On Feb 16, 2006, at 11:45 AM, Marcos Trejo Munguia wrote:

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

This is pretty easy to test yourself. Just iterate over a large array (100,000 elements might be sufficient depending on the speed of your computer) using both approaches printing the time before and after the iterations.

With a particularly large array, I was concerned about this eons ago. I found that using an Enumeration was somewhat slower, but for smaller arrays, the difference was insignificant in the grand scheme of things. But things may have changed now, so a quick test might be worthwhile.

Aloha,
Art

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to