Jump to content

Engine.QueryInterface Performance


Recommended Posts

Hey guys,

I was wondering since we have a lot of calls that goes like this Engine.QueryInterface(component_IID, entity) if that would not be a performance gain to actually cache them in Init functions ? For some small components that might be negligible but maybe for stuff like UnitAI it could make some difference.

Link to comment
Share on other sites

This exposes us to dangling pointers, as the component pointed-to may very well be deleted at some point (particularly for components referring to other entities).

Now 0 A.D. doesn't actually change an entity's templates (i.e. its components) at runtime right now, so we could take some liberties with components of the same entity, but that's probably not something we want to do from a design point of view. Then again, changing components at runtime might be too difficult to ever implement.

What we could maybe do is a component cache on the JS side to avoid going back to c++ everytime, but that's also scary for mostly the same reason. At the moment, we have bigger performance concerns imo.

  • Like 1
Link to comment
Share on other sites

Sure was just wondering since I remember reading something that stated that the interactions between the two languages were slow.

19 minutes ago, wraitii said:

his exposes us to dangling pointers, as the component pointed-to may very well be deleted at some point (particularly for components referring to other entities).

That would only be for things refering to this.entity :)

20 minutes ago, wraitii said:

What we could maybe do is a component cache on the JS side to avoid going back to c++ everytime, but that's also scary for mostly the same reason. At the moment, we have bigger performance concerns imo.

True.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...