+17 votes

Having worked with Game Maker Studio in the past I know their engine has one of two ways to manage it's scripting language known as Game Maker Language or GML Script. The first is to compile the GML script to bytecode and then interpret that at runtime, the other option being to compile the GML Script to C++ along with the runner which gives a big performance boost on native platforms. I was just wandering how the Godot engine handles it's scripting language?

in Engine by (30 points)

2 Answers

+2 votes

I've been informed that GDScript is compiled to byte code and interpreted at run-time. No native compilation is done.

by (30 points)
+13 votes

GDScript is not compiled to native binaries ahead of time (AOT). It is not compiled just-in-time (JIT) either. In short, it's an interpreted language, similar to Python in how it is run.

However, exporting your game will, by default, convert your .gd scripts to .gdc bytecode (resulting in slightly faster loading of the game, in some cases). Exporting in release mode will give large performance improvements because of the lack of run-time checks that are only helpful for debugging. You can sometimes notice a performance improvement of 300% by exporting in release mode, in contrast to running from the editor.

by (12,889 points)

How have you measured that (300%) improvement?

Since it is runtime interpreted code, are there things we can do in the gdscript files themselves (like minification) that would help the tokenizer to run faster? Things like short variable names, removing spaces etc?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.