Skip Navigation

Where have you suffered some performance penalties using GDScript, and what was the fix? Was it to rewrite it in C#?

docs.godotengine.org GDScript: An introduction to dynamic languages

About: This tutorial aims to be a quick reference for how to use GDScript more efficiently. It focuses on common cases specific to the language, but also covers a lot of information on dynamically ...

I'm curious because GDScript sounds like a very high and good abstraction for the engine.

Dynamic nature

Pros & cons of dynamic typing

GDScript is a Dynamically Typed language. As such, its main advantages are that:

  • The language is easy to get started with.
  • Most code can be written and changed quickly and without hassle.
  • Less code written means less errors & mistakes to fix.
  • The code is easy to read (little clutter).
  • No compilation is required to test.
  • Runtime is tiny.
  • It has duck-typing and polymorphism by nature.

While the main disadvantages are:

  • Less performance than statically typed languages.
  • More difficult to refactor (symbols can't be traced).
  • Some errors that would typically be detected at compile time in statically typed languages only appear while running the code (because expression parsing is more > strict).
  • Less flexibility for code-completion (some variable types are only known at run-time).

Additionally, the interesting thing for me, it resembles Python

It uses an indentation-based syntax similar to languages like Python. GDScript is entirely independent from Python and is not based on it.

and because I come from Rust, this is mind-boggling for me:

Memory management

Godot implements reference counting to free certain instances that are no longer used, instead of a garbage collector, or requiring purely manual management. Any instance of the RefCounted class (or any class that inherits it, such as Resource) will be freed automatically when no longer in use. For an instance of any class that is not a RefCounted (such as Node or the base Object type), it will remain in memory until it is deleted with free() (or queue_free() for Nodes).

5
5 comments