> Yep, it's a big win.  Even if the default allocator does something  
> similar (and I think you're right that a linked list of free blocks of  
> a given size is maintained by the malloc code, or something of that  
> sort), this scheme avoids a fair handful of method calls and function  
> calls per object, and so it wins big even just with that.  I can't  
> remember what the degree of speedup was (I put this scheme in several  
> months ago now), but it was quite substantial.

http://www.mikeash.com/pyblog/performance-comparisons-of-common-operations.html

According to which, alloc + init + release costs about the same as 35-40 method 
calls.

The code I posted could cache [MyClass class] if (as I do) you like to leave 
the asserts in your release code.  And it works, of course, because the isA 
pointer in all instances of a particular class is the same.

Paul Sanders.
_______________________________________________

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