• 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: Art Isbell <email@hidden>
  • Date: Thu, 16 Feb 2006 12:11:08 -1000

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >objectEnumerator vs objectAtIndex (From: Marcos Trejo Munguia <email@hidden>)

  • Prev by Date: Re: objectEnumerator vs objectAtIndex
  • Next by Date: Re: objectEnumerator vs objectAtIndex
  • Previous by thread: Re: objectEnumerator vs objectAtIndex [SOLVED]
  • Next by thread: pulling data from 2 tables
  • Index(es):
    • Date
    • Thread