Re: Cocoa et al as HCI usability problem
Re: Cocoa et al as HCI usability problem
- Subject: Re: Cocoa et al as HCI usability problem
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 23 May 2008 22:11:39 -0700
Nice graphs!
On May 23, 2008, at 9:39 PM, Adam R. Maxwell wrote:
I did some crude benchmarking a while back and found that
NSFastEnumeration was roughly the same as using
CFArrayGetValueAtIndex() in a loop, and both were faster than using
NSEnumerator or -[NSArray objectAtIndex:].
The significance of this depends on your situation, of course. In
an app that enumerates thousands of small collections while parsing
a file, dumping NSEnumerator in favor of CF functions was a big win
in terms of time and memory profiles in Shark, mainly because of the
overhead associated with creating/using/destroying lots of
enumerators. NSEnumerator also sends retain/autorelease to the last
object of its collection, so it can cause a pool to fill up if
you're not careful.
Note that doing the iteration yourself via CFArrayGetValueAtIndex() is
-- as Adam indicates -- quite fast. One of the big advantages to
fast enumeration is that you leave more decisions about optimal
enumeration behaviors up to the object being enumerated.
Moot for arrays, by and large, but can be a big factor in other kinds
of collections.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden