|
From: James T. <ja...@fl...> - 2023-06-13 15:28:44
|
> On 12 Jun 2023, at 20:46, TheFGFSEagle <the...@gm...> wrote: > > Oh great, could you explain it a bit, please ? I have no idea how it could work without storing a pointer to the node ! :mrgreen: > Well, you are right of course, but what I did was replace the simple pointer to the target node (which was already present in the size of SGPropertyNode), with a helper struct ‘AliasData’ which contains the target node and the listener pointer. So I replaced a pointer to one kind of thing, with a pointer to a slightly more sophisticated thing, no magic. This is the same pattern we use for listeners; the first time you add a listener to a property we allocate an extra struct to store the listeners and related info, so if you never add a listener at all, we only pay the cost of the empty pointer. In principle there’s a bit more of this kind of thing we could do, to put SGPropertyNode on a diet, but the disruption to the existing code would be high, so I’m not super keen on that. Kind regards, James |