Boost Godot Project Performance With This Simple Trick

Поділитися
Вставка
  • Опубліковано 21 січ 2025

КОМЕНТАРІ • 150

  • @eddex.
    @eddex. 6 місяців тому +187

    Even if your game runs fine static typing helps so much when debugging issues and can even prevent you from creating bugs. There's really no reason not to use it even in small projects.

    • @btCharlie_
      @btCharlie_ 6 місяців тому +12

      I didn't even know there were performance benefits to type hinting in GDScript... I use it because it's so much easier to write code with intellisense that knows the types of variables and outputs and it highlights the irritating type mismatch bugs before compilation even.

  • @davidbarkhausen7739
    @davidbarkhausen7739 6 місяців тому +100

    didn't realize functions could be statically typed for a performance boost too... Very useful.

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +21

      I'm not 100% sure if typing functions gives the same performance increase as for variables. My understanding is that statically typing all the things lets the interpreter take shortcuts when running the code, increasing the performance. Thanks for watching!

    • @ShiloBuff
      @ShiloBuff 6 місяців тому +1

      One thing I've wondered is if typing void or Variant improves performance. Both are implicit. Such as no return = void. And Explicit and implicit Variant has the same results. So I've always wondered if typing either leads to better performance or just unnecessary and more verbose code (bad).

    • @davidbarkhausen7739
      @davidbarkhausen7739 6 місяців тому +10

      I did statically type all the functions in my project where I could see an obvious return type - mostly voids, Arrays, bools and ints, and I have already noticed reduced loading times, and was able to slightly increase the frame rate on my most laggy level... There are still some hiccups here and there I need to work on - most likely due to textures... But it does seem to run more smoothly overall. I'll have to look into Variant because one of my most used functions returns different objects or null. Thanks.

    • @JayLooney
      @JayLooney 6 місяців тому

      @@ShiloBuff it's not necessarily bad even if it's not functionally necessary for the interpreter. Typing a method as void will indicate to you or another programmer that the method shouldn't return anything -- and also if you make the mistake of returning something it will allow the environment to complain at you. To answer your implicit question though, typically void typing won't see any performance gains.
      Why typing gives you performance gains in the first place is because the more refined your type the more specific the handling can be. If I have an untyped value it could be literally anything at all so the receiving side has to account for "What if it's a list or a string or a hashtable or a ..." and has to have code to handle all of those circumstances to prevent crashing. If instead you type a value as a "Number" now it only has to think about "Is it an int? Is it a float? Is it signed or unsigned? How big is it?.." and the more refined you get your typing, say to "uint8" now the receiver is certain, the value I'm working with is going to be an unsigned 8 bit wide integer, all the code that would manage receiving arrays and strings and floats doesn't need to exist anymore. When the return type is void, not only will you be returning nothing... there will be no receiver to even make an optimization decision about it. -- That said it's still worth it because it adds human understanding and will be optimized out at runtime for free.

  • @mirasmussabekov4897
    @mirasmussabekov4897 6 місяців тому +39

    Search this and Godot docs says "Also, typed GDScrypt improves performance by using optimized opcodes when operand/argument types are known at compile time.", which means that this should indeed work, given that documentation is accurate.
    Also it continues in the same paragraph "More GDScripts optimizations are planned in the future, such as JIT/AOT compilation.".

    • @mirasmussabekov4897
      @mirasmussabekov4897 6 місяців тому +4

      Also apparently there are "Type Hints".
      You access them through "Editor" -> "Text Editor" -> "Completion" -> "Add Type Hints".

  • @RetroCrowDev
    @RetroCrowDev 6 місяців тому +34

    Bro WHAT I thought programmers were just being fancy and organized by doing that, nobody told me it boosted performance by 60% lmao
    Thank you!

    • @igorthelight
      @igorthelight 4 місяці тому +2

      It's a new thing in Godot 4. In Godot 3 it only helps autocomplete ;-)

    • @ShadeKirby500
      @ShadeKirby500 4 місяці тому

      Tbh its both. I like it and I've not considered the performance gains. Because I love the intellisense improvement, I love that I can't accidentally set my number to a string like a dumbass

  • @evan_game_dev
    @evan_game_dev 6 місяців тому +28

    Awesome vid! I'm a C dev so I just prefer this way lol, but I can confirm the speed and bug improvements after doing this

  • @aidanlaing4272
    @aidanlaing4272 6 місяців тому +46

    You can also check the "Add Type Hints" box under editor settings to have autocompletion add the static types for you in some cases. Instantly subscribed after seeing the debug option. Really great video thanks.

  • @guardllama8922
    @guardllama8922 6 місяців тому +4

    I've been hammering my head against this wall trying to learn programming as a hobby for 5-6 years now. I've run across this concept of static vs dynamic typing so often and it always confused me so I just thought "I'll worry about it tomorrow I guess." Somehow this video just really simplified it and something clicked for me. Thank you!

  • @aqua-bery
    @aqua-bery 6 місяців тому +2

    Omg my prediction was spot on. Static type EVERYTHING!

  • @andre-angelo-devlog
    @andre-angelo-devlog 6 місяців тому +10

    Thanks! I didn't realize you could make it give a warning in the project settings. 👍👍

  • @Kry0000
    @Kry0000 4 місяці тому

    Thank you for making this video, I've heard the same answer from others when it comes to the performance gain of static typing, this help's reinforce their statements. I forgot that you could set the editor to error at non-static types, so thank you for that reminder.

  • @jkouss
    @jkouss 6 місяців тому +2

    Thank you for showing us the real performance gain in numbers. Other videos on the subject are missing that

  • @paxtianplays8735
    @paxtianplays8735 2 місяці тому

    This is great. Static typing is always my preference, I had no idea it was also a speed boost!

  • @JustVoylin
    @JustVoylin 6 місяців тому +6

    This is something I had been doing a bit, but since the last couple of months I've been fully static typing variables and functions.

  • @zhengistasbolatov8480
    @zhengistasbolatov8480 6 місяців тому

    I watched a couple of GDQuest videos, and he does that, but I never heard explanation. Thank you!

  • @buzzbuzz20xx
    @buzzbuzz20xx 6 місяців тому +2

    Wow that’s crazy ! Now I finally understand why some coders like to declare variable types, I’ll be doing it from now on !

    • @broomybroomybroomy
      @broomybroomybroomy 4 місяці тому

      I mean it's not only faster, it's also less bug prone that way

  • @soviut303
    @soviut303 6 місяців тому +14

    Let's hope GDScript gets array typing soon.

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +15

      You actually can type arrays in GDScript now.
      var my_array: Array[int] = [1,2,3,4]
      Although, it doesn't have the best support and can be a little finicky. Hopefully that will be addressed in the near future, along with nested array and Dictionary types like you see in TS

  • @raphango
    @raphango Місяць тому

    Awesome tips! Thanks! God bless you!🎉

  • @hylucien2980
    @hylucien2980 6 місяців тому

    thanks for the tip. i knew of static typing i just didn't know why i should use it. i have a small game underway but luckily i'm not very deep yet so i can change the code to static typing :)

  • @yucelcelik372
    @yucelcelik372 4 місяці тому

    Hey thanks this was actually helpful even if not with performance it was with cleaner code and the video was right to the point.

  • @UncleCabinet
    @UncleCabinet 6 місяців тому

    Holy shit! Thanks man this has drastically improved my performance

  • @dmsys6516
    @dmsys6516 5 місяців тому +1

    There's one more important benefit, namely you will get autofill depending of type of variable/packed_scenes/texture/resource/nodes/etc. It really helps when you are using resources and classes and passing them from editor
    - i think its on by default but If you dont see them
    You access them through "Editor" -> "Text Editor" -> "Completion" -> "Add Type Hints".

  • @dennisandress6561
    @dennisandress6561 3 місяці тому

    I like clean code, so I already did that but I didn't know it would make a difference, thanks

  • @NuttachaiTipprasert
    @NuttachaiTipprasert 6 місяців тому +12

    Still don't understand the point of dynamic type. Just to save seconds of typing time and waste hours or days to hunt down bugs relating to mismatch type? That sounds like an unworthy tradeoff. The fact that most dynamic typing languages had to introduce static typing at some point already proved my point.

    • @deforrest-studios
      @deforrest-studios 5 місяців тому +5

      It's sad to say that most dynamic programming is done because of the inability to teach typing, or learning typing. So our answer was to automate it.
      In other words, it's lazy way to solve a trivial problem.

    • @yapp2yapp2
      @yapp2yapp2 4 місяці тому +4

      @deforrest-studios that’s something you made up. typing is fundamental and easy to learn and the origins of dynamic typing is to support some far edge cases and lazy convenience

  • @KucheKlizma
    @KucheKlizma 5 місяців тому

    Hey that's super cool, I thought these are just type hints like in python. I guess I didn't bother reading the full manual and didn't realize these are proper static type declarations. Thanks!

  • @mr1880
    @mr1880 6 місяців тому

    worth the watch for the knowledge that I can set untyped declarations to throw errors alone, knowing it improves performance is the icing on the cake 😂 great video, thank you for the info.

  • @copperbadge1
    @copperbadge1 6 місяців тому +4

    EDIT: Looks like you struck gold with this topic. If you ever feel like talking about the debugger in more detail (for dummies like me who are 99% reliant on prints like a caveperson) I'll be there to watch it. 👍
    Funnily enough, I already started using static types for my exported variables to get the proper inputs in the inspector, but hearing they also help with performance is good to know and I'll really have to get used to using return types again.
    Thanks!
    Oh and the := operator is great for primitive types. Yes, I am *that* lazy of a typer. :D

    • @igorthelight
      @igorthelight 4 місяці тому +1

      More info about debugging: ua-cam.com/video/P7AQLUU3xKk/v-deo.html

  • @nrwl23
    @nrwl23 4 місяці тому

    tl;dr Use staticly typed variables bc gdscript can decide what it doesn't need to do, making everything faster. Excellent Untyped Declaration tip too. Great video, thanks. Subbed.

  • @heraldoffire5104
    @heraldoffire5104 22 дні тому

    I've always used static typing, and GDScript was no exception when I started learning it. The difference honestly doesn't surprise me. Any time variants are used, you're adding extra processing time as the engine figures out what type of variable it's meant to be before engaging with it. C# variants get around this problem because they're not *actually* variants, they're strongly typed variables that inherit their type from their declaration (eg. var myVar = Object ). It's why you can only use them as locals.

  • @5ionnach205
    @5ionnach205 6 місяців тому

    Thank you for this tip!! I heard about it before, but didn't know it made such a difference :D

  • @setaindustries
    @setaindustries 6 місяців тому

    Coming from Unity I already did this as standard practice, good to know this actually helps performance lol!

  • @anothercastle17
    @anothercastle17 14 днів тому

    I was static typing variables already just because it felt like it made things more readable, but I was unaware of the performance boost, I'll keep this in mind.

  • @asdfasdfasdfasdf-f3p
    @asdfasdfasdfasdf-f3p 5 місяців тому +1

    This simple example should be in the godot documentation with an explanation - you can use the Variant type, but with a 30% performance loss.

  • @skell_jams
    @skell_jams 6 місяців тому +2

    any hints for statically typing a dictionary? in c# you would Dictionary but I can't figure this out for gdscript

    • @fatihvahip2765
      @fatihvahip2765 6 місяців тому +6

      there is no static typing for dictionaries in Godot currently

    • @CmdZOD
      @CmdZOD 4 місяці тому

      According to the official website, it's coming with 4.4. I'm so glad !

  • @DanielAttaway
    @DanielAttaway 6 місяців тому

    Thanks for the video 🤙🤙 I will start with this even for a minor performance boost

  • @decorummortis5175
    @decorummortis5175 3 місяці тому

    C# and C++ have a massive community so there is there, that means you just need to know what you are looking for they are not originally designed for game programming but had business and scientific backings

  • @AlyphRat
    @AlyphRat 6 місяців тому

    3:09
    If you press CTRL+R, you will enable "replace".
    You can simply replace all "=" with ":=", and anything after a paranthesis "()" with "() -> void" to fix all errors.

    • @igorthelight
      @igorthelight 4 місяці тому

      Not a great idea - some "=" are just to assign a new value ;-)

  • @Sonngohanda
    @Sonngohanda 2 місяці тому

    That's a part of why Godot was so slow in the past, and in certain cases still is. The Core Api relied a lot in Magic Strings, and the Variety Type. The performance would be amazing if other languages were first - class citizen
    I guess GDscript will eventually get there.

  • @KyleLuce
    @KyleLuce 6 місяців тому

    You can avoid explicit types at assignment, and still get static typing, by using the shortcut:
    var total := 100
    Instead of
    var total : int = 100
    A little tip that reduces boiler plate when the types are already easily readable in code. ( This pattern is also in other popular languages: Kotlin, C++ (auto), etc)

    • @igorthelight
      @igorthelight 4 місяці тому

      True!
      But that was shown in the video tho ;-)

  • @Seraph120
    @Seraph120 5 місяців тому

    I wondered what are the implications of using the ':'. Now I know. Thank You!

  • @VladimirZuev-Elbacha
    @VladimirZuev-Elbacha 6 місяців тому

    Great Video!

  • @spyhacksgadgets4016
    @spyhacksgadgets4016 28 днів тому

    Thanks man, interesting. Coming from embedded C++, not declaring the variable types is confusing to me. I did not know it actually boost performance!

  • @Kadad65
    @Kadad65 6 місяців тому

    Very good tip, I never thought about it, oops a lot of work is waiting for me, thank you :)

  • @Lexiosity
    @Lexiosity 6 місяців тому

    1:20 the first thing I noticed was that the movement was done in _process and not _physics_process

  • @borismarcone6991
    @borismarcone6991 6 місяців тому

    The issue is when you use arrays. And i dont mean simple ones like an array of ints. I mean stuff like an array of array when each element is an array where the first element is an int, the second a node2d, the third a string.

  • @BigBossRazz
    @BigBossRazz 6 місяців тому +1

    As a self taught absolute newb of a coder, could you please explain how when I would/wouldn’t set a function to void? That part has always tripped me up. Declaring the types seems super straightforward though, so thanks for the great video!

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +3

      void is the function return type when you dont return any value(s) in the function's code. The _process() and _ready() node functions are some examples of this. If you need a value from that function (let's say a string) somewhere else you can set the return type as String. This is only needed to satisfy static typing with the setting.

    • @BigBossRazz
      @BigBossRazz 6 місяців тому +1

      @@DeepDiveDevelop So… if you don’t return anything at all, use Void. That makes sense… but does that only mean when you literally have “return X” in your code? Or are there other examples when you need to return something? Thanks for the reply!

    • @CmdZOD
      @CmdZOD 4 місяці тому +1

      @@BigBossRazz You can call a function to work with parameters and return the result. Here is a super basic exemple,
      func add(a:int, b:int) -> int:
      var result: int = a + b
      return result
      what's cool is that GDScript will check if the return type is correct and if you actually return a result.

    • @BigBossRazz
      @BigBossRazz 4 місяці тому

      @@CmdZOD sweet, thanks for the help!

  • @Aeduo
    @Aeduo 5 місяців тому

    It's like remembering to put % after everything in QBASIC that should be an int.

  • @Caellyan
    @Caellyan 6 місяців тому

    I'd say a good rule of thumb is to almost always use static types unless the function will work with generic types or you're writing an addon (types are erased (duplicated but not equal) when passed to those it seems).

  • @fifolker
    @fifolker 6 місяців тому +1

    Someone know if there is a way to set the default script of godot with ready and process func with static declaration for all the projects ?

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +3

      Looks like this is possible, Check out docs.godotengine.org/en/stable/tutorials/scripting/creating_script_templates.html

  • @fishnpotatoes
    @fishnpotatoes 6 місяців тому

    personally I don't like the untyped declaration as an error since it doesn't work nicely with some things like Array.map/filter/reduce, or dictionaries. you can also just look at the line number, if it's green that means that line is completely typesafe, otherwise it's not

  • @protogionlastname6003
    @protogionlastname6003 6 місяців тому +2

    But dictionaries are still untyped 😥

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +2

      It will be a glorious day when they add typed dictionaries and generics

  • @OnyxIdol
    @OnyxIdol 6 місяців тому

    Another advantage of static typing is intellisense support.

  • @Jinrty
    @Jinrty 6 місяців тому

    Thank you so much !

  • @out1007
    @out1007 5 місяців тому

    I always use static typing (Haskell refugee), but it never appeared to me how much of a performance increase it is for Godot.

  • @purplelord8531
    @purplelord8531 6 місяців тому

    I wouldn't have thought of this - python has a very similar syntax called 'type annotation' but it doesn't seem to do much except for add additional checking. interesting!

  • @cosmilitebar6772
    @cosmilitebar6772 4 місяці тому

    Good to know, i thought is was like in python where it does not give you more performance. Also it can prevent you from generating bugs. So its probably worth all the time - even in non-performance-critical parts of the projects.

  • @kunai9809
    @kunai9809 6 місяців тому

    Thanks for this, but you forgot something useful!
    Editor Settings -> Text Editor -> Completion -> Add Type Hints.
    With this setting, selecting functions via auto complete that can be overwritten (like _ready() etc.), they automatically get their type hint.

  • @JamesResend
    @JamesResend 6 місяців тому

    Nice work, Ill try it

  • @eturnerx
    @eturnerx 6 місяців тому +1

    I prefer not to use := because if I don't understand the type I'll probably create bugs later. Coming from making typescript servers, love static types for reducing coding errors.

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +2

      yes, its hard to go back to JS and dynamic types after trying out typescript!

    • @eturnerx
      @eturnerx 5 місяців тому

      Update: I will use := where I'm creating an object with .new() because the type is obvious and repeating it makes the code less readable.
      E.g. var img := Image.new()

  • @dom1310df
    @dom1310df 6 місяців тому

    Coming from Python Godot's type hints felt very natural. The colon equals syntax is interesting, but I'm not convinced of its usefulness when assigning to a $ operation or a function call. For assignments to literal objects it's more worthwhile as it's as obvious there to the reader as the engine.

  • @F00dstamp96
    @F00dstamp96 4 місяці тому +1

    I hate dynamic typing. Static typing just solves so many issues and, in my opinion, reads better. I think in types and values, not just values.

  • @BlackJar72
    @BlackJar72 6 місяців тому +1

    C# isn't hard at all, though one problem I have with Godot is its poor support for it (especially on Linux). Its still interesting that you can get such a boost by just by properly defining your variable types, static typing ftw (I never liked "var" type declarations in any language).

    • @RenderingUser
      @RenderingUser 6 місяців тому +3

      How else do you declare variables?
      Worst case of declaring types is probably python imo

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому

      Yeah I think C++ is the more difficult one for sure. When I first got into godot I did C# for the extra performance, though I was scared away by the lack of support (I'm on linux too).

  • @evopeer
    @evopeer 6 місяців тому

    this helped, thanks

  • @decepi
    @decepi 6 місяців тому

    Huh, I thought my code was running faster because coding skills were improving. Might just have been because I swapped fully to static typing as the other languages I use also use it (TypeScript, Swift).

  • @nightfox_69
    @nightfox_69 6 місяців тому

    Woa, thanks!

  • @BenjaminWheeler0510
    @BenjaminWheeler0510 6 місяців тому

    I don’t like that it can’t auto-infer type of `var a = 5` it’s obviously capable when you use `:=`

    • @igorthelight
      @igorthelight 4 місяці тому

      var a = 5
      a would have dynamic type
      var a := 5
      a would have static type
      It's not about that it couldn't. It's a programmer's choice ;-)

  • @content8420
    @content8420 6 місяців тому

    I am a C++ dev who uses godot. Since I learned c++ before gdscript, I can't stop declaring datatypes😅

    • @Reymax164
      @Reymax164 5 місяців тому

      I'm still in college, but I can feel you being a Java programmer 😅

  • @rodolfolorote9059
    @rodolfolorote9059 Місяць тому

    Which is faster
    1 - var number: int = 10
    2 - var number := 10
    I heard 1 is faster than 2, but is it true?

  • @shrippie-4214
    @shrippie-4214 4 місяці тому

    Good thing I mostly learned Godot not knowing how to make variables any other way than Static types

  • @oosukeren
    @oosukeren 6 місяців тому

    What do I do in something like my case... I've custom built Godot 3.1 with export templates for windows XP, there isnt untyped warning in the settings, plus they're not a radio button, but a boolean, so if I have to take the logic from the newer version yall are using, it'd take some time.. Is it really worth it? I just want to make the best out of my retro machine games...

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому

      I believe the performance increases are only available after godot 4.0. I can't speak too much about the prior settings before Godot 4, but still plenty of reasons to static type in 3.1!
      godotengine.org/article/gdscript-progress-report-typed-instructions/

    • @oosukeren
      @oosukeren 6 місяців тому

      @@DeepDiveDevelop okay, thank you, that's really appreciated! 🙏🙏🙏

  • @SuperTommieNL
    @SuperTommieNL 6 місяців тому +1

    Liked and subscribed! Can you do one about finite state machine setup in godot4?

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +1

      That's a good one. I'll add that to my list. Thanks for watching!

  • @rawvoxel
    @rawvoxel 6 місяців тому

    I enabled all static-type-related features as compiler errors. GDScript is cool, but I HATE Type inferencing. That being said, I picked up C# and am learning Rust to add to the arsenal. I'm pretty sure there's also a setting to autocomplete the static types for variants, static return types for methods, and when droppping nodes from the inspector.

    • @rawvoxel
      @rawvoxel 6 місяців тому

      Editor Settings > Text Editor > Completion > Type Hints

    • @alexstone691
      @alexstone691 6 місяців тому

      Is there an option to make them be treated as compiler error

    • @rawvoxel
      @rawvoxel 6 місяців тому +1

      @@alexstone691 In the options shown in this video, you have the option to disable them, treat them as warnings, or treat them as an error. It's the drop down menu to the right of each of the settings.

    • @alexstone691
      @alexstone691 6 місяців тому +1

      @@rawvoxel thank you!

  • @loganb2198
    @loganb2198 4 місяці тому

    I always static type everything simply for auto complete purposes.

  • @morganp7238
    @morganp7238 6 місяців тому

    subbed and liked, thanks

  • @billy91011
    @billy91011 6 місяців тому

    How would that make things faster? (Not saying it doesn’t I just don't understand how that would effect it)

    • @Reymax164
      @Reymax164 5 місяців тому

      My guess is it's trying to figure out the data type first everytime they are used
      Which what makes it slow.
      So if the data type is already known, they don't need to figure it out anymore.

  • @Julianiolo
    @Julianiolo 5 місяців тому

    Nice video! But how are you calculating your speedup at 2:33? 1 - static_time / dynamic_time is not the speedup, idk know what that is lol. I guess the phrase A is x% faster than y is somewhat ambiguous. I guess a reasonable way to interpret that is to look at the amount of time it takes less than the base case (as a percentage of the base case). So then 40% faster than 100 would be 100 - 40%*100 = 60. Defined like that you would calculate it like this: (static_time - dynamic_time )/static_time = 1 - dynamic_time /static_time.
    So I guess your version is like how much more time does dynamic take than static as a percentage of static? I don't even know at this point lol, my head hurts.
    Also, generally speed tests in debug mode can behave pretty different than in release mode, so testing is release mode would be better. Idk how much that applies to godot, but its probably better to test for the case of a released game than a debug build.
    But as I said, nice video :)

    • @DeepDiveDevelop
      @DeepDiveDevelop  5 місяців тому +1

      Oh shoot! Thanks for letting me know I got the formula wrong. I must've rushed through that part of the code.
      The new formula I came up with for percent faster is:
      (dynamic_time / static_time - 1) * 100
      I reran the performance tests and here are the new results, which have numbers that make more sense I think:
      dynamic add nums: 0.66875791549683
      static add nums: 0.44424700737
      static is 51% faster
      dynamic mult nums: 0.63372111320496
      static mult nums: 0.44116997718811
      static is 44% faster
      dynamic vector2 dist: 1.77509212493896
      static vector2 dist: 1.18353796005249
      static is 50% faster
      dynamic vector2 add: 0.85133600234985
      static vector2 add: 0.35749793052673
      static is 138% faster
      And yeah you're right about the debug vs release build performance. I just focused on the debug build for this vid, but I found some articles that cover the numbers for that if you are interested.

  • @Paruthi.618
    @Paruthi.618 6 місяців тому

    Thank a lot.. very informative..

  • @PlayBASIC-Developer
    @PlayBASIC-Developer 4 місяці тому

    Static types make compile time optimization a reality also..

  • @Rai2M
    @Rai2M 5 місяців тому

    I do miss the days when you had no "variable" types and had to follow strict typing.

  • @indigoUanP
    @indigoUanP 6 місяців тому

    does giving static return types to functions also help?

  • @q404
    @q404 2 місяці тому

    song name at end?

    • @breckheck
      @breckheck 2 місяці тому

      The roost from animal crossing

  • @Reymax164
    @Reymax164 5 місяців тому

    I came from Java(my first language), it's the only one I know before trying and started to learn Godot and GDScript a week ago.
    Coming from a C based language, I'm too used in declaring the data types, so I started doing that right away after finding out I can do it 😅
    I'm learning Python alongside GDScript right now… I hate Py.

  • @tomppeli7727
    @tomppeli7727 6 місяців тому

    I have quite a lot nodes(objects) per scene on a 2d game, this chance would benefit mainly the process loop(s) most? What is actually under the hood when comparind difference on dynamic / non dynamic vars?

    • @G4M5T3R
      @G4M5T3R 3 місяці тому +1

      The interpreter has to infer types for dynamic variable. For example: You can't do math on strings. What should GoDot do in this situation?
      var num1 = 3
      var num2 = "abc"
      var result = num1 + num2
      Throw an error? Or just infer that num1 is also a string, because num2 isnt an integer, then simply combine them?
      Those checks and safeguards cost performance. If the vars are static then the interpreter can skip trying to figure out the types in your data.

  • @diligencehumility6971
    @diligencehumility6971 2 місяці тому

    The biggest performance gain you can get is changing to C#

    • @Sonngohanda
      @Sonngohanda 2 місяці тому

      C# performance isn't actually that great in Godot (Not the language's fault), each Godot api call is a whole glued marshalling conversion that relies in Magic Strings, barely typed since is designed for Gdscript. The more api calls, the less performance gains
      You'd need to ditch the whole editor node system to get a huge performance difference, and just leverage Dotnet apis or wait for the Gdextension C# update. For Roguelikes and generative content would be beneficial tho.
      Anyway, for performance nothing beats recompililing the engine and writing C++ stuff modules right in the library, Rust would be amazing if it were officially supported.

  • @jurajojo2543
    @jurajojo2543 6 місяців тому

    oh, well, I already prefered static typing everything so *this video was in fact clickbait technically for me*
    (this is just because I chose to follow a tutorial that showed me how to static type before and if I can static type, I will)

    • @teistensean7227
      @teistensean7227 6 місяців тому

      Could you share the link or title of the tutorial

  • @Burnrate
    @Burnrate 6 місяців тому

    I would suggest you should have also gone over the differences from the explicit and inferred type declarations instead of just randomly interspersing their use in the video without explanation.
    Also making the _process delta typed could have used a bit of a highlight. Using const will statically type a variable too.
    Nice overview though.

  • @Ronscoe
    @Ronscoe 6 місяців тому +5

    nice vid bud, audio quality needs a bit of work: if you toss a blanket over your head and mic, it can cut out the hovercraft in the background

    • @DeepDiveDevelop
      @DeepDiveDevelop  6 місяців тому +3

      Lol, yeah my PC fans are kinda loud. Thanks for the feedback!

  • @cjdaylight3407
    @cjdaylight3407 3 місяці тому

    it is not massive Performance boost. it is better use gd script on prototype or demo projects for real thing it is better to use C++ or C.
    my general reason using gd script is fast compile time. but when projects ready. I convert my code to C++ or C

  • @Thund3rboltGaming
    @Thund3rboltGaming 6 місяців тому

    bro inherits from characterbody2d and uses _process function instead _physics_process where all physics objects should be, but shows amazing tip LMAO

  • @ddxyzz
    @ddxyzz 6 місяців тому

    Interesting

  • @tqwewe
    @tqwewe 6 місяців тому +4

    I don't use godot, i clicked for the cat

  • @Sergejack
    @Sergejack 6 місяців тому

    C# will plunder your performances. I went there and thrust me, that cake is a lie.

    • @froggin-zp4nr
      @froggin-zp4nr 6 місяців тому

      Garbage in garbage out. The performance gains have already been tested. You need to refactor your code structure

  • @_.-.
    @_.-. 5 місяців тому

    Wait, you Neanderthals seriously program without declaring variable types?

  • @veto_5762
    @veto_5762 6 місяців тому

    I always used static types since I was already used to it for using C++, honestly I never understood what real uses dynamic typing could have

  • @aeolianthecomposer
    @aeolianthecomposer 4 місяці тому

    I'm slightly disappointed cause I was already using these
    Good video tho

  • @Mithaldu
    @Mithaldu 6 місяців тому

    next time just state what you're doing up-front, then elaborate on it, and i might actually believe you're a genuine person