discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C 2.0 and other new features in Leopard


From: address@hidden
Subject: Re: Objective-C 2.0 and other new features in Leopard
Date: Thu, 08 Nov 2007 01:13:46 -0800
User-agent: G2/1.0

On 8 Nov., 09:23, Graham J Lee <address@hidden> wrote:
> That's supposedly for performance purposes - apparently there are  
> people who care that the KVC mechanism is too slow.

Oh yes. KVC needs one method call to setValue:forKey, and another one
for calling the real setter. And, if it is setValue:forKeyPath: the
keypath must be split up first to traverse the path. If this is done
by componentsSeparatedByString and an enumerator, it needs 2
additional method call for setting up the loop and one for each
component.

So: obj.a.b.c=val;

[obj setValue:val forKeyPath:@"a.b.c"]

needs spprox.
1 - forKeyPath:
2 - separate components and set up enumerator
3*3 - 3 components with nextObject, value:forKey: which ends up in
calling the real getter
==
12

while

[[[obj getA] getB] setC:val]

is just 3 calls. Factor 4...

Well, we can design the translator to emit ObjC-1.0 code for any of
both approaches... It is just some string manipulation to embed into
the parser grammar.

BTW: did anybody look into my ObjC-2.0 translator project yet? And,
should we make it part of the GNUstep code base?

-- hns



reply via email to

[Prev in Thread] Current Thread [Next in Thread]