Delsin-Yu / CSharp-Wrapper-Generator-for-GDExtension

This editor plugin generates C# wrappers for classes from the GDExtension plugins.
MIT License
16 stars 2 forks source link

Possible Performance Improvment for the Generated Wrappers #21

Open GeorgeS2019 opened 5 months ago

GeorgeS2019 commented 5 months ago

Feedback

It is amazing that the wrapper codes generated WORKS! However, the performance needs to be addressed based on previous feedback from others.

I could be wrong. Hopefully we all learn together.

Reference1

This means consuming GDExtensions is currently possible, but not ideal (because we lose type safety).

  • The bindings generator retrieves everything from ClassDB and generates the glue, we would probably need to refactor it so we can allow generating only certain classes (like the ones registered through GDExtensions).

==> Addressed here

The generated bindings source code use unsafe code blocks which would require user projects to also enable unsafe code blocks and, in my opinion, this is not acceptable.

==> here we are not generating unsafe code

Reference2

Don't use ClassDB.Call/Set/Get in the core of the engine for C# bindings as I have.

Reference3

the situation is similar to interop with GDScript, where you would also rely on GodotObject (or ClassDB I guess)

Reference4

It may be possible to use C# Source Generators to generate the proxy types for GDExtension types when building the C# project, but as far as I know no one has started working on this at the moment.

Relevant only to GDMP

GeorgeS2019 commented 5 months ago

@ZerxZ

Just curious, how this PR will improve performance or address any of the issues discussed above

Delsin-Yu commented 5 months ago

@ZerxZ

Just curious, how this PR will improve performance or address any of the issues discussed above

Please try to restrict the discussion to their corresponding issue, thank you.

Delsin-Yu commented 5 months ago

Reference 2 and 3 (ClassDB-based APIs) are what we are using currently, there is performance improvement we can make based on that.

Reference 4 provides the best performance and integration, but yes, that requires implementing it in the Engine.