On Sep 23, 2009, at 2:27 PM, Matt Gough wrote:

        NSEnumerator *iter = [myMutableArray objectEnumerator];

        while (syncInfo = [iter nextObject]) {
                ... Do some stuff
        }

That's not a fast enumerator; that's the old-fashioned slow enumerator. (Although as already pointed out, the major slowness you saw was caused by warnings being logged, not by the type of enumeration.)

If you want fast enumeration you have to use the Obj-C 2.0 for...in loop syntax:

        for (syncInfo in myMutableArray) {
                .. Do some stuff
        }

This is the fastest and clearest way to iterate. Under the hood the fast-enumeration API is being used to fetch multiple objects out of the collection in bulk and pass them one by one to your code, without having to allocate new objects or send a message every time.

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to