On 8 Nov., 09:23, Graham J Lee <[EMAIL PROTECTED]> 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

_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to