gdext
gdext copied to clipboard
[Performance Issue] The godot ffi layer is a bottleneck for my use cases
In my performance investigation I see a lot of usage of:
PhysicsDirectBodyState2D
-> get_transform
, get_velocity
...
For these, the times are much higher than in the C++ equivalent. I even make the functions be no-op, but the overhead is still there.
What I see is Godot calls inside PhysicsDirectBodyState2D
5 times, with 5 different functions, and in 3D mode about 6 times. Old version of plugin was able to do 8800 circles, so that would be for 2D 8000 * 5 times per second.
The function right now looks like this:
#[godot_api]
impl IPhysicsDirectBodyState2DExtension for RapierDirectBodyState2D {
fn get_transform(&self) -> Transform2D {
Transform2D::IDENTITY
}
}
I would like to have a more efficient way of doing this, if possible.