State of GDScript vs C# performance in Godot 4.0

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nikola-Milovic

Hello everyone, my question has been asked before but I’ve seen a lot of mixed answers on the topic. Basically I am a developer already so working with either GDScript or C# isn’t a problem, but all the games I am planning to make require performance, one is heavy on the math and simulations and the others are real-time multiplayer games. Both benefit from faster computations

Now here are my questions

  1. What’s the general state of performance in both when comparing them?

  2. How’s the support for C# for Godot?

  3. When it comes to non-computation-heavy workloads like general logic, the difference shouldn’t be noticeable in performance, I guess?

  4. Is mixing and matching these two something that’s feasible? Is there any overhead to share data across these two?

Haven’t been in gamedev for some while and any other opinions you have I’d love to hear! It’s not that I don’t want to use GDScript, I love it, but since I have to host these if the C# is 10x faster that will save me money and will provide a better experience to my players

:bust_in_silhouette: Reply From: Ussderydmjr
  1. C#, unlike GDScript, has full and strict typing and order in the code and enumerations, and there is enough functionality. (With the documentation, everything is OK for both). In addition, C#+Godot, unlike GDScript+ Godot, normally and fully support all popular IDEs.
  2. On the issue of performance, I’ll just quote the developers : “According to some preliminary benchmarks, the performance of C# in Godot — while generally in the same order of magnitude — is roughly ~4× that of GDScript in some naive cases. C++ is still a little faster; the specifics are going to vary according to your use case. GDScript is likely fast enough for most general scripting workloads. C# is faster, but requires some expensive marshalling when talking to Godot.”
:bust_in_silhouette: Reply From: GiantArtisan

gdscript calls the godot method is the fastest, faster than c#. But your code is more about calling .net methods, so no doubt c# is faster than gdscript. You can test it, call a few godot methods at random, check the execution time of gdscript and c#, you will find that gdscript is the fastest.