Re: 3 obj-c/cocoa beginner q's
Re: 3 obj-c/cocoa beginner q's
- Subject: Re: 3 obj-c/cocoa beginner q's
- From: "Clark S. Cox III" <email@hidden>
- Date: Tue, 25 Mar 2003 13:51:00 -0500
On Tuesday, Mar 25, 2003, at 13:03 US/Eastern, Mondragon, Ian wrote:
personally, i almost always loop over arrays in the standard way:
---
int count, i;
count = [array count];
for (i = 0; i < count; i++)
{
// whatever
}
---
i found out long ago that, while they're nice, NSEnumerators can kill
the
performance of programs when abused...and they're horrible to use when
you're using nested loops in the same types of programs.
just my 2 cents...
If I'm in an area of code where I'm worried about speed, and I expect
to iterate over the same array multiple times, then I will do something
like this:
unsigned count = [array count];
id *objects = malloc(count * sizeof *objects);
[array getObjects: objects];
for(unsigned i=0; i<count; ++i)
{
... objects[i] ...
}
free(objects);
--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.