I mean, yes, a compiled language is faster than an interpreted one, I think the docs even directly state this.
Edit: I was knee jerking at the “most people will tell you” because that’s been the exact opposite of my experience. Thought the above was relevant but not really
In most games, the scripting language itself is not the cause of performance problems. Instead, performance is slowed by inefficient algorithms (which are slow in all languages), by GPU performance, or by the common C++ engine code like physics or navigation. All languages supported by Godot are fast enough for general-purpose scripting. You should choose a language based on other factors, like ease-of-use, familiarity, platform support, or language features.
In general, the performance of C# and GDScript is within the same order of magnitude, and C++ is faster than both.
Comparing GDScript performance to C# is tricky, since C# can be faster in some specific cases. The C# language itself tends to be faster than GDScript, which means that C# can be faster in situations with few calls to Godot engine code. However, C# can be slower than GDScript when making many Godot API calls, due to the cost of marshalling. C#'s performance can also be brought down by garbage collection which occurs at random and unpredictable moments. This can result in stuttering issues in complex projects, and is not exclusive to Godot.
No. I think the general consensus is that C# is faster.
From the devs: "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."
The cases where GDScript are faster consist of those where there's a great deal of marshalling and unmarshalling, like with heavy engine calls and signaling. If you're doing compute heavy work.
GDScript is still plenty fast, so use the one that's most comfortable.
4 Comments
aburrito@sh.itjust.works · 14 pts · 30d
I mean, yes, a compiled language is faster than an interpreted one, I think the docs even directly state this.
Edit: I was knee jerking at the “most people will tell you” because that’s been the exact opposite of my experience. Thought the above was relevant but not really
aburrito@sh.itjust.works · 18 pts · 30d
Follow up from the gdscript docs for my own reference:
In most games, the scripting language itself is not the cause of performance problems. Instead, performance is slowed by inefficient algorithms (which are slow in all languages), by GPU performance, or by the common C++ engine code like physics or navigation. All languages supported by Godot are fast enough for general-purpose scripting. You should choose a language based on other factors, like ease-of-use, familiarity, platform support, or language features.
In general, the performance of C# and GDScript is within the same order of magnitude, and C++ is faster than both.
Comparing GDScript performance to C# is tricky, since C# can be faster in some specific cases. The C# language itself tends to be faster than GDScript, which means that C# can be faster in situations with few calls to Godot engine code. However, C# can be slower than GDScript when making many Godot API calls, due to the cost of marshalling. C#'s performance can also be brought down by garbage collection which occurs at random and unpredictable moments. This can result in stuttering issues in complex projects, and is not exclusive to Godot.
josephc@lemmy.ml · 6 pts · 30d
No. I think the general consensus is that C# is faster.
From the devs: "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."
The cases where GDScript are faster consist of those where there's a great deal of marshalling and unmarshalling, like with heavy engine calls and signaling. If you're doing compute heavy work.
GDScript is still plenty fast, so use the one that's most comfortable.
RaphaelSchmitz@feddit.org · 2 pts · 28d
"Heavy engine calls" sounds slightly off.
If you do a lot of processing work in code and then send it over to Godot in one "heavy" engine call, C# will be faster.
But if you do less work in code with MANY Godot calls, the translation cost can easily overshadow the performance advantage of C# itself.