[Dev News] Grit – GDScript to C++ Compiler - xSicKxBot - 11-09-2026
One of the downsides of GDScript is worse performance, especially compared to C# and C++. Grit is a new experimental toolchain that potentially solves the GDScript performance issues. How? By compiling your game’s GDScript code to C++ which is then compiled to native code. The result – anywhere from 1.1X to 50X faster performance, depending heavily on the code converted. Grit requires no changes to your project or the GDScript, happening entirely at the point your game’s executable is built. Grit is essentially identical to Unity’s IL2CPP, but instead of converting intermediate language output to C++, it converts GDScript to C++.
Features of Grit:
- Broad GDScript coverage: all 1540 functions in Godot’s own GDScript test suite compile to native code, and all 499 test assertions pass when running natively.
- Unboxed values: typed , and as well as value types such as , , or live in plain C++ variables instead of .
- Direct engine calls: operations the VM validates at compile time call Godot’s pointer APIs directly. Engine operators, member accessors and constructors are inlined when Grit can prove they are exactly what the engine uses.
- Direct script calls: calls between functions of the same script file skip the engine’s dispatch and jump straight into the native function, with the same override, object lock and recursion checks as the VM.
- Engine properties: reading and writing properties such as or calls the engine’s getter or setter directly with unboxed values. Object properties such as skip the generic lookup too, on reads and on writes where the assigned value’s type is known to fit. Each access site caches the resolved accessor per class, and objects whose scripts intercept a property with , or a member of the same name keep the VM’s behavior.
- Script members: reading and writing member variables of other script instances, such as , goes straight to the instance’s member storage whenever no getter, setter or type conversion is involved.
- Script stripping: optionally removes the code of natively compiled functions from the exported scripts.
- Built-in scripts: scripts embedded in scenes and resources are compiled as well, not only files.
- Containers: fast element access for , packed arrays and , with the same bounds and type checks as the VM.
- Full language support: lambdas (with captures and ), and coroutines, signals, inner classes, static functions and variables, default and rest parameters.
- Same behavior: runtime errors, their messages and edge cases such as integer overflow or division by zero behave like in the VM.
- Debugging: native functions appear in script backtraces, and with the correct lines.
- Safe fallback: unsupported functions, edited scripts or mismatching signatures silently use the VM, per function.
Key Links
Grit GitHub Repository
Spritebench Benchmark from Video
Author Thread on Creation of Grit
You can learn more about Grit and see it in action in the
below. This is a highly experimental project and obviously shouldn’t be used in production.
|