Benchmarking C# vs gdscript

3 months ago by truthfultemporarily to c/godot

YouTubessa voit nauttia parhaista videoista ja musiikista, ladata alkuperäistä sisältöä ja jakaa kaiken ystäviesi, perheesi ja koko maailman kanssa.

Most people seem to agree gdscript should be faster for heavy engine work, but that's not what I found.

aburrito 14 points 3 months ago

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

path: 0 24876625, hotness: undefined, score: 14, children: 1
aburrito 18 points 3 months ago

Follow up from the gdscript docs for my own reference:

Which programming language is fastest?

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.

path: 0 24876625 24876659, hotness: undefined, score: 18, children: 0
josephc 6 points 3 months ago

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.

path: 0 24888717, hotness: undefined, score: 6, children: 1
RaphaelSchmitz 2 points 3 months ago

"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.

path: 0 24888717 24925491, hotness: undefined, score: 2, children: 0
godot
godot

@programming.dev

login for more options
7978
1193
558

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

  • Posts need to be in english
  • Posts with explicit content must be tagged with nsfw
  • We do not condone harassment inside the community as well as trolling or equivalent behaviour
  • Do not post illegal materials or post things encouraging actions such as pirating games

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

  • The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
  • The banner is from Godot Design

go to feed...