Re: Zeroing out instance variables
Re: Zeroing out instance variables
- Subject: Re: Zeroing out instance variables
- From: Ben Haller <email@hidden>
- Date: Sat, 17 Apr 2010 09:04:38 -0400
So, thoughts? Am I insane? Is the above scheme safe? Is there a
better way? Thanks for any feedback!
(I think this question is appropriate for cocoa-dev rather than the
objc-language list, but my apologies if I have posted to the wrong
forum...)
My question to you would be: have you profiled this versus the
standard object allocation mechanism to see if you're actually
gaining anything? My understanding was that the default allocator
does something fairly similar already.
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.
Ben Haller
McGill University
_______________________________________________
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