Your GDScript arrays are slower than you think — I built a CLI that detects the pitfalls and benchmarks them
"Why is my enemy loop stuttering? I'm not even doing anything heavy here." Every Godot tutorial tells you to just use arrays. Nobody tells you that an untyped array holds Variants, that a sequential-key Dictionary is ~2x slower than a plain Array, or that the official docs contradict themselves about packed arrays. This is about gd-bench , a CLI I built that scans your .gd files for array-type…
Godot tutorials often recommend using arrays without warning about performance pitfalls. A new open-source tool called gd-bench scans Godot projects for inefficient array usage and generates benchmark scripts to measure the impact. Key findings include:
- Untyped arrays hold Variants and are the slowest to iterate
- Typed arrays are fine but PackedInt32Arrays are faster for the same element type
- Packed arrays provide contiguous memory for the fastest access
- Dictionaries filled with sequential keys are ~2x slower than plain arrays
The gd-bench tool helps developers discover these performance issues, generate micro-benchmarks, and determine the optimal array type for their specific use case. By measuring before rewriting, developers can avoid folklore-based performance advice and ensure their code runs efficiently. The scanner uses regex-based pattern matching to identify common GDScript array declarations but does not analyze complex expressions or literals passed to functions.
The generated benchmarks are plain GDScript scripts that can be run in CI or on a Godot 4 headless binary for deterministic testing.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.