Re: [Foo new] vs [[Foo alloc] init]:
Re: [Foo new] vs [[Foo alloc] init]:
- Subject: Re: [Foo new] vs [[Foo alloc] init]:
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 16 Feb 2008 16:15:20 -0800
On Feb 16, 2008, at 3:55 PM, Jonathan Dann wrote:
On 16 Feb 2008, at 23:28, Bill Bumgarner wrote:
I just checked all the way back to 10.1. The implementation was
+allocWithZone: NULL followed by -init until Leopard, when it moved
to +alloc followed by -init.
If the behavior had changed to anything that avoided either of
those methods (keeping in mind that +alloc is a cover for
+allocWithZone: until the latter was effectively deprecated as
zones have fallen out of recommended practice),
So in Leopard, as you say zones have fallen out of recommended
practice, does that still mean that +alloc calls +allocWithZone: or
is there a new implementation of +alloc? If not then +new involves 1
more message call than +alloc -init, and could cause a slight
performance loss with the extra call? Could this performance hit
ever be seen, realistically speaking?
Unless you are allocating a bazillion objects, it is unlikely that the
extra message would matter. More likely, all that pounding on the
allocator is going to be the bulk of the cycles consumed.
In this area, what Objective C really needs is a bulk allocator. But
not so much that it has risen in importance to actually implement it.
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