Subj : Re: Performance Interfacing to C++ To : netscape.public.mozilla.jseng From : Brendan Eich Date : Wed Aug 25 2004 08:14 am Thorsten R wrote: > I found an old message from 2001-07-04 via Google, which says: > > >>>... interfaced JS with C ... > > It seems to me, however, that these C functions (get, set, etc.) are called > by the engine subsequent to the engine's own internal JavaScript object > manipulation routines (i.e. the engine sets a property on the object using > it's own internal set method, then almost as an afterthought, it calls my > set method). > << Why didn't you provide a link to this old message? That's what URLs are for, and it's hard to tell what you are talking about without it. > Brendan Eich had confirmed that this is true. Yes, and it's not a bug. For most native and host objects, the shared code to manage slots and properties (in a per-runtime lexicographic tree) is a win. > I would like to ask if this is still true in 8 / 2004? And if so, why? I > can't see the reason, since the object has pointers declared for its getters > and setters to external C functions, which should solely be responsible for > getting and setting properties. Think a little harder, then. If every object had to implement its own hash tables and obj->slots value storage, there would be much duplicated code. Even if you factored all that code into common subroutines, the high-level interface (JSObjectOps) would call into different Date, String, RegExp, etc. implementations, which would have to duplicate calls to the common subroutines. It's better to have a common "middleware" implementation of JSObjectOps for most such classes. This actually evolved after the lower-level JSClass interface, but that's history. > Are there any plans to change this? No concrete plans that you should count on. > Brendan had also pointed to use JSObjectOps() to work-around that problem. It's not a work-around, it's an alternative, and the problem is a solution for most native and host classes. > I > looked at JSObjectOps(), but the docs are not very clear about it and rather > confusing. Can someone help on how to use this method? JSObjectOps is not documented. You'll have to read the source and understand the interface yourself. If you can't do that, then I can't recommend you using it. Perhaps you could say more about your embedding and why you don't need the usual property lookup and value storage mechanism? /be .