C# is BETTER than GDScript but...

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
GD script is the obvious choice for scripting in Godot right well it's not really that simple stick around because we're going to uncover the truth behind this whole debate and the results may surprise you first we really should address the elephant in the room how you doing today Ed well Jolene brought fish for lunch again now the whole damn break room smells like an old dock worker's Boot and the stench is starting to creep its way into the office that's how I'm doing [Music] let's talk about some of the differences in these high-level languages so C Sharp's been around for a really long time whereas GD script is relatively new c-sharp can be a little harder to learn and GD script is typically pretty easy c-sharp is a strongly typed language which means you have to explicitly Define the type of your variables whereas GD script doesn't require this there are more tutorials available online for c-sharp whereas there are fewer for GD script not all of the c-sharp tutorials are related to Game Dev but a lot of that information carries over lastly c-sharp is used throughout the software development industry whereas GD script is really only used in Godot now that we have a basic understanding of the differences between these two languages let's get right into some performance tests and see how they compare the first workload we're going to look at is iteration how quickly your code can iterate and modify a collection is very important we'll be using Shuffle and sort algorithms to test this [Music] let's look at some basic array shuffling [Music] foreign it looks like c-sharp is about 20 times faster than GD script for this it's worth noting though that GD script has a shuffle function that will match the performance of c-sharp in this case but it does so by moving the iteration to a lower level language which is not a fair comparison so what about bubble sort everybody hates bubble sort [Music] looks like GD script really hates bubble sort it's worth noting the GD script does have a built-in function to sort an array but it uses Heap Sort and not bubble sort and it also sends the iteration to a lower level language so it is a doubly unfair comparison so clearly c-sharp is the winner of the iteration Olympics but what about calculation is c-sharp still faster than GD script when calculating values we're going to test this with matrix multiplication now matrix multiplication is an iterative workload but a single calculation isn't going to make or break the performance of your program it's when you iterate over calculations that really makes the big difference [Music] foreign [Music] looks like GD scripts losing again being almost 46 times slower than the c-sharp implementation of the same exact algorithm now you might be thinking clearly C sharp is better than GD script in general right but wait till you see what happens next when we actually try to access the Godot API with c-sharp let's have a look at some basic scripting workloads and we're going to do this by applying a transformation to a node you're going to use this sort of workload more often than you use any other sort of workload in Game Dev let's have a look at how these two languages perform when every node is responsible for resizing itself [Music] well we have a clear winner here as well in GD script this is the first time it's happened and you might be wondering why gdscript outperforms C sharp in this case the answer to that question is marshalling the performance cost of marshaling this logic is very expensive and it will translate into the performance of your application but what if I told you we can double our FPS and c-sharp by simply writing our code to accommodate the marshalling costs let's take a look at what happens when we use a manager script to control our scaling rather than let the objects handle that themselves GD script still comes out ahead but we've effectively doubled our FPS using the same logic in C sharp we're just doing it all with a single script foreign language should you use it doesn't matter it's more important that you understand the limitations of the language and write your code to accommodate them thanks for watching and we'll see you guys on the next one
Info
Channel: hamsterbyte
Views: 983
Rating: undefined out of 5
Keywords: Godot, C#, Tutorial, indie dev, gamedev, godot engine, godot 4, godot 4.0, godot 4 beta, godot 4 alpha, godot 4 tutorial, made with godot, games made with godot, migrate to godot 4, how to make a game in godot, why use godot, how to godot, how to learn godot, godot 4.0 tutorial, godot tutorial, how to use godot
Id: S2tTEPHIS1I
Channel Id: undefined
Length: 5min 12sec (312 seconds)
Published: Fri Jun 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.