godot_rapier3d icon indicating copy to clipboard operation
godot_rapier3d copied to clipboard

What's the purpose of rapier3d_standalone?

Open geekrelief opened this issue 4 years ago • 3 comments

I'm playing around with the IntegrationParameters and noticed rapier3d_standalone is taking 20 seconds out of the 30 seconds to compile. So I commented it out, and it doesn't seem to affect running things in Godot.

geekrelief avatar May 28 '21 20:05 geekrelief

rapier3d_standalone is the dynamic library (cdylib) that is used by Godot while rapier3d is a Rust library that can be directly included in other Rust libraries.

I do it that way so that a game can be shipped with one big library instead of many smaller libraries (which all include duplicate code from stdlib, godot-rust ...)

Debug builds should compile quite a bit faster. For release builds LTO is enabled and codegen-units is set to 1 since it produces slightly better code. While debug builds do make FFI slower it shouldn't affect Rapier itself too much since dependencies are still compiled with opt-level = 3.

Demindiro avatar May 28 '21 20:05 Demindiro

Thanks for the explanation. Forgive me if this is common knowledge for Rust programmers. I'm still making my way through the Rust book. But I just tried searching through it, and I just realized 'cdylib' isn't even covered in it. Though it is in the Rust Reference.

Do you think your comment should be in the README?

geekrelief avatar May 28 '21 20:05 geekrelief

Thanks for the explanation. Forgive me if this is common knowledge for Rust programmers. I'm still making my way through the Rust book. But I just tried searching through it, and I just realized 'cdylib' isn't even covered in it. Though it is in the Rust Reference.

I guess cdylib isn't covered because it's specifically intended for FFI, which does have a chapter in the Rustonomicon (though the only mention of cdylib seems to be in panic_handler...).

Do you think your comment should be in the README?

I think a separate file describing the layout / architecture of this project (like ARCHITECTURE or maybe CONTRIBUTING) would be more appropriate.

Demindiro avatar May 28 '21 20:05 Demindiro