On 2 May '08, at 12:18 PM, Ben wrote:

I have a C array where the elements within it can be converted into multiple objects. Say I have 5 objects. Do I provide them all in one go and return the total number? Or just one per call and return the number remaining?

Return as many as you can at once, for best performance. What makes this API fast is that it allows the caller to loop over lots of objects at once inline, without having to keep calling into the enumerator. In tight loops the overhead of the Obj-C method dispatch (or CoreFoundation function call) is the dominating factor.

If you can return large numbers of objects at once, the performance of fast-iteration becomes nearly as good as using a native C array. (I did some of the early prototyping of this, a few years ago; IIRC, at about 50 objects per call, the overhead became negligible.)

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to